I am fairly new to Python (and programming in general), so please excuse my lack of knowledge or understanding to something you may find obvious. I'm not stupid though, so hopefully I should be able to work it out.
I am making a small text-based survival game, and I have encountered an issue which I cannot seem to solve, which is the:
AttributeError: 'int' object has no attribute 'sleep'
In the console when I try and run my program.
import time , sys , random , shelve
# /gather command
if '/gather' in Input and command_state == True:
if 'wood' in Input:
print('Collecting wood...')
if tool != "Axe":
time.sleep(random.randrange(5 , 10))
print("Test")
else:
time.sleep(random.randrange(5 , 10))
print("Test")
I really don't understand what is causing this and after looking through the advice given on similar topics I have found no solution. Any help would be appreciated!
If you'd like me to put up the whole script, please just ask. I have only put up the block of code that was causing the issue (because none of the other code seemed to affect anything here).
As commented above you are overwriting the time
module by making a variable named time. Simply rename the time
variable!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With