main.py
import engine
engine.objects['key'] = "It's a key"
engine.main()
engine.py
# inventory = []
objects = {
}
def main():
while True:
choice = raw_input(">>: ")
command, obj = choice.split()
if command == 'examine':
if obj in objects:
print objects[obj]
else:
print 'joking right?'
else:
print 'joking right?'
When I type "examine" with no second word, the parameter, it gives me an error.
>>: asdf
Traceback (most recent call last):
File "main.py", line 3, in <module>
engine.main()
File "C:\Users\Patrick\Documents\Programming\Game engine test\engine.py", line
11, in main
command, obj = choice.split()
ValueError: need more than 1 value to unpack
Press any key to continue . . .
I understand why, but how do I fix it?