Select to view content in your preferred language

Unable to successfully save code in Validation tab

520
3
07-19-2012 07:45 AM
by Anonymous User
Not applicable
I am unable to edit, save, and apply validation code to my custom Python script in ArcGIS Desktop 10.1.

Please follow these instructions and see if you can get them to work:

1) In ArcToolbox, right-click a custom Toolbox and go to Add > Script...
2) Leave the default properties and click Next >
3) Either leave the Script File blank, or pick an existing script, or type the path of a script that doesn't exist, and click Next >
4) Click Finish
5) Right-click your new script and go to Properties...
6) Click the Validation tab
7) Click Edit..., make no changes, save if you want, and close your editor.
😎 Click OK or Apply on the Properties dialog.  In my situation, I get the following message:

---------------------------
Testing get_ParameterInfo
---------------------------
initializeParameters Syntax Error: Runtime error
Traceback (most recent call last):
  File "#Script.InitializeParameters.py", line 1, in <module>
  File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\__init__.py", line 24, in <module>
    from arcpy.toolbox import *
  File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\toolbox.py", line 342, in <module>
    from management import Graph, GraphTemplate
  File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\management.py", line 22, in <module>
    import _management
  File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\_management.py", line 14, in <module>
    import _graph
  File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\_graph.py", line 27, in <module>
    import numpy
ImportError: No module named numpy

---------------------------
OK  
---------------------------

Note that none of these error messages talk about the file I'm editing at the time.  These are all files within the Python installation from ArcGIS Desktop.
Tags (2)
0 Kudos
3 Replies
JakeSkinner
Esri Esteemed Contributor
Hi Roger,

Looks like the error is stating that you do not have the 'numpy' module installed.  Can you open your Python editor and try to import this module:

import numpy


Do you receive an error when you run this?
0 Kudos
by Anonymous User
Not applicable
No, I do not receive an error when I run that command from IDLE.  This is true whether ArcGIS Desktop is closed or open.  My IDLE shortcut is the default one that installs with ArcMap:

C:\Python27\ArcGIS10.1\pythonw.exe "C:\Python27\ArcGIS10.1\Lib\idlelib\idle.pyw"

In trying to solve the problem, I noticed that I still had a left-over directory from 10.0 called C:\Python26, so I deleted it to the Recycle Bin.  But that didn't seem to change the dialog's behavior either.

My guess is that this doesn't happen to you in 10.1, though?
0 Kudos
JakeSkinner
Esri Esteemed Contributor
Unfotunately, I don't receive this error.  What is your Editor set to under Geoprocessing > Geoprocessing Options > Script Tool Editor/Debugger?

Clear this so that it is blank, and test to see if you get the error.  The editor should default to notepad when this is empty.  Let me know if you still receive the same error.
0 Kudos