windows - AttributeError: 'module' object has no attribute 'testmod' Python doctest -


when ever try doctest in python, whenever run code

if __name__ =="__main__":    import doctest    doctest.testmod() 

i response interpreter

attributeerror: 'module' object has no attribute 'testmod'

i can run code fine, whenever run on windows machine, doesn't work.

my machine running windows theirs os x, running python 2.7.5.

thank :)

it looks there different module called doctest being imported instead of standard one.

to find out module being imported exactly, add following print:

if __name__ =="__main__":    import doctest    print doctest.__file__  # add    doctest.testmod() 

the print should produce similar c:\python27\lib\doctest.pyc, depending on location , version of python you're using. other output means importing wrong module, , explain why you're getting error.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -