3

So this line of code in my Python game is not working:

direction=raw_input("What would you like to do?\n")

It's supposed to get the player to type in a command either: North, South, East, West, Look, Search, Commands or Inventory. It's coming up with this:

Traceback (most recent call last): File "/Users/khalilismail/Desktop/COMPUTING/Text-based Games/DragonQuest.py", line 173, in direction=raw_input("What would you like to do?\n") EOFError: EOF when reading a line

Please help

Here is the stack of code surrounding this: while game==on:

while place==town:

    direction=raw_input("What would you like to do?\n")

    if direction=="west":
        if "iron ore" and "wood" and "3 Gold Pieces" in items:
            print "The blacksmith greets you, and you tell him that you have the items and money he requires, you also give him the saw to make up for some of the difference, he then forges you a battleaxe and wishes you luck on the rest of your quest"
            items.remove ("saw")
            items.remove ("3 Gold Pieces")
            items.remove ("iron ore")
            items.remove ("wood")
            items.append ("battleaxe")
JimiLoe
  • 950
  • 2
  • 14
  • 22

1 Answers1

0

As suggested in the comments, some editors don't support input (including Atom). Here are some options you can overcome this:

  1. Set the direction variable by hard-coding it while debugging (don't forget to remove it after debugging)
  2. Change your editor (keep in mind that Sublime also has the same problem, but this has a workaround - Sublime Text 2 console input; Notepad++ however doesn't have this problem when running code through command line).

You could also try and remove the newline '\n' from the raw_input string to test if it works.

Community
  • 1
  • 1
kasparg
  • 428
  • 3
  • 14