Weird AttributeError With Imports
Juha S.
jusa.sj at gmail.com
Sun Oct 28 13:05:17 EDT 2007
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.
The module (mytime.py) sits in a package hierarchy such as the following
"packageA.packageB.mytime", and imports the Python module "time" like
this: "import time"
In another module outside of both packages (in a folder that holds the
other package folders) I do this:
from packageA.packageB import mytime
timer = mytime.Time() #Throws the above AttributeError
Strangely it seems that if I create a Time object in mytime.py
everything works perfectly. I have no idea why I'm getting this error,
so any help is welcome!
More information about the Python-list
mailing list