[Tutor] Weird Error

Shrivats shrvtsnvs at gmail.com
Sat Dec 17 16:45:50 CET 2011


Hello, 
On Sat, Dec 17, 2011 at 10:19:37AM -0500, Ken G. wrote:
> I have use 'sleep.time(5)' in most of my program but the following error 
> is throwing me for a loss.
> 
> import time
> Traceback (most recent call last):
>   File "/home/ken/Python2/Blood Glucose/BloodGlucose04ReadingTimed.py", 
> line 63, in <module>
>     time.sleep(2)
> AttributeError: 'str' object has no attribute 'sleep'
Here's your clue: Do you have another string variable that apparently goes by
the name 'time' ? I have added another line to your snippet below. Running that
will throw the same error you see above. 
> 
> Using the following is okay:
> 
> import time
> print "Now"
time="hello"
> time.sleep(2)
> print "Later"
> 

HTH,

Shrivats


More information about the Tutor mailing list