Select to view content in your preferred language

What is the difference between running a Python script in IDLE vs in ArcMap?

4752
9
06-04-2015 01:01 PM
CarlaInclan
Deactivated User

The default value of arcpy.env.workspace is different, are there other differences?

The reason to ask is that I have code to geocode several files using a loop to call the function arcpy.GeocodeAddresses_geocoding. The loop works fine when I execute the script inside the Python window in ArcMap, but when I run the script in IDLE it ends in error 999998 when it starts the second iteration.

I hope that understanding the differences between these two ways of executing the script will help me find a way to make it work in IDLE.

Thanks

Carla

0 Kudos
9 Replies
TonyAlmeida
MVP Regular Contributor

I believe one is that Arcmap python window is 32 bit and you could run IDLE in 64 bit.

You might want to post your code so we can see what your attempting to do.

MatthewRusso
Emerging Contributor

I run larger scripts in the command line, they work faster and I believe Tony is correct

0 Kudos
SepheFox
Deactivated User

The other, more obvious difference, is that you have to hardcode your paths, files, and mxds.

0 Kudos
DanPatterson_Retired
MVP Emeritus

Seph...that isn't correct ... you can use sys.argv to access your script arguments in both PythonWin and PyScripter and I am sure in any other program...in that way you don't have to hardcode them

SepheFox
Deactivated User

Oh really? So how do you enter the arguments in that case?

DanPatterson_Retired
MVP Emeritus

ahhhh  Just a pythonwin example  every IDE is slightly different

enter_param.png

SepheFox
Deactivated User

Oh neat! Thanks for the info. So, for more than one argument, would you just put a list with commas between?

0 Kudos
DanPatterson_Retired
MVP Emeritus

details with your IDE space delimited for PythonWin

enter_param3.png

DanPatterson_Retired
MVP Emeritus

Here is PyScripter example

enter_param2.png

0 Kudos