Weird AttributeError With Imports

Juha S. jusa.sj at gmail.com
Sun Oct 28 18:50:24 CET 2007


Peter Otten wrote:
> Juha S. wrote:
>
>   
>> I'm getting a "AttributeError: 'module' object has no attribute 'clock'" 
>> when importing a module from within two packages related to the line: 
>> "self.lastTime = time.clock()" in the __init__() of the class Time in 
>> the target module.
>>     
>
> You probably have a time module that you wrote yourself and which is now
> hiding the one in python's standard library. Was your mytime.py formerly
> named time.py, and if so, did you remove the corresponding time.pyc?
>
> Peter
>   

Yes, I did have mytime.py named as time.py previously. Now that I 
deleted the .pyc it seems to work fine. Thanks!



More information about the Python-list mailing list