Select to view content in your preferred language

User Input Code for ArcGIS 10.1 Python Window

1303
1
Jump to solution
06-26-2013 03:22 PM
ShikoNjuno
Deactivated User
I'm trying to write script in the Python Window that will allow a user to input a value for a defined object.
However, I keep getting this error message.
Any suggestions?


>>> input ('Enter the object weight' )
Enter the object weightRuntime error
Traceback (most recent call last):
  File "<string>", line 1, in <module>
EOFError: EOF when reading a line
>>>

I also tried the following script

>>> eval(raw_input("Enter your weight: "))
Enter your weight: Runtime error
Traceback (most recent call last):
  File "<string>", line 1, in <module>
EOFError: EOF when reading a line
>>>
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
ShaunWalbridge
Esri Regular Contributor
For these kinds of tasks, the best practice is to use script tool parameters in a geoprocessing tool which accepts the input you want. If you're learning Python, and do want to accept command line input, the Python window embedded in ArcGIS probably isn't the best place to start. You should have a python.exe included in the installation, and if you run that from the command line, then you can perform basic python operations like this:

var = raw_input("Enter your weight: ")


cheers,
Shaun

View solution in original post

0 Kudos
1 Reply
ShaunWalbridge
Esri Regular Contributor
For these kinds of tasks, the best practice is to use script tool parameters in a geoprocessing tool which accepts the input you want. If you're learning Python, and do want to accept command line input, the Python window embedded in ArcGIS probably isn't the best place to start. You should have a python.exe included in the installation, and if you run that from the command line, then you can perform basic python operations like this:

var = raw_input("Enter your weight: ")


cheers,
Shaun
0 Kudos