[Tutor] time.sleep() error

geon geon at post.cz
Tue Aug 2 20:05:36 CEST 2005


geon napsal(a):

>sunny sunny napsal(a):
>
>  
>
>>Hi all,
>>
>>I am using time.sleep to stop my program execution for some time. I
>>have imported time and am able to use it sucessfully in the main
>>program.
>>
>>However if I use it in any function I get the following error:
>>
>>the time.sleep(1) command generates this error :
>>TypeError : 'int' object is not callable 
>>
>> 
>>
>>    
>>
>
>Dont you actually have something like this?:
>
>from time import *
>
># somewhere you use sleep like this
>sleep=10
>
># and then
>sleep(1)
>
># you get:
>#    sleep(1)
>#TypeError: 'int' object is not callable
>
>In this case you "overwrite" the original function sleep() with your/my
>variable sleep....
>Solution: rename your/my variable sleep to f.e. notAwake=10 :-)
>
>  
>
Solution2: do not use from time import *.  Prefer import time. Now you 
know why :-)
Its not a waste of time still to rewrite you code in this way.

-- 
geon


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050802/264ed36d/attachment.htm


More information about the Tutor mailing list