testadventurelib.py I edited the cast(magic) function by adding
obj = inventory.find('mallet')
drop(obj)
as shown below.
def cast(magic):
if magic == None:
say("Which magic you would like to spell?")
elif magic == 'fireball':
say("A flaming Fireball shoots form your hands!")
obj = inventory.find('mallet')
drop(obj)
This produces the error:
cast fireball
A flaming Fireball shoots form your hands!
Traceback (most recent call last):
File "main.py", line 85, in
start()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/adventurelib.py", line 536, in start
_handle_command(cmd)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/adventurelib.py", line 509, in _handle_command
func(**args)
File "main.py", line 82, in cast
drop(obj)
File "main.py", line 52, in drop
obj = inventory.take(thing)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/adventurelib.py", line 260, in take
obj = self.find(name)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/adventurelib.py", line 236, in find
if name.lower() in item.aliases:
AttributeError: 'Item' object has no attribute 'lower'
if I change obj in drop(obj) to drop('mallet') it functions as expected.
testadventurelib.py I edited the cast(magic) function by adding
as shown below.
def cast(magic): if magic == None: say("Which magic you would like to spell?") elif magic == 'fireball': say("A flaming Fireball shoots form your hands!") obj = inventory.find('mallet') drop(obj)
This produces the error:
if I change obj in drop(obj) to drop('mallet') it functions as expected.