debugging - Line of Python code not working in my game -


so line of code in python game not working:

direction=raw_input("what do?\n") 

it's supposed player type in command either: north, south, east, west, look, search, commands or inventory. it's coming this:

traceback (most recent call last): file "/users/khalilismail/desktop/computing/text-based games/dragonquest.py", line 173, in direction=raw_input("what do?\n") eoferror: eof when reading line

please help

here stack of code surrounding this: while game==on:

while place==town:      direction=raw_input("what do?\n")      if direction=="west":         if "iron ore" , "wood" , "3 gold pieces" in items:             print "the blacksmith greets you, , tell him have items , money requires, give him saw make of difference, forges battleaxe , wishes luck on rest of quest"             items.remove ("saw")             items.remove ("3 gold pieces")             items.remove ("iron ore")             items.remove ("wood")             items.append ("battleaxe") 

as suggested in comments, editors don't support input (including atom). here options can overcome this:

  1. set direction variable hard-coding while debugging (don't forget remove after debugging)
  2. change editor (keep in mind sublime has same problem, has workaround - sublime text 2 console input; notepad++ doesn't have problem when running code through command line).

you try , remove newline '\n' raw_input string test if works.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -