Select to view content in your preferred language

Error when running script from toolbox, but fine when run in python window

4637
8
Jump to solution
08-23-2016 09:00 AM
Zeke
by
Honored Contributor

I'm running into an error when running various tools from the toolbox (e.g. Table To Excel, Geo Tagged Photos To Points), but they run fine when run in the python window. No one's been able to figure this out. Any ideas? Thanks.

Toolbox error attached, python window results below.

>>> import arcpy
>>> arcpy.GeoTaggedPhotosToPoints_management("c:/data/photos", "c:/data/city.gdb/photo_points", "", "ONLY_GEOTAGGED", "ADD_ATTACHMENTS")
<Result 'c:\\Data\\City.gdb\\photo_points'>
>>> arcpy.GeoTaggedPhotosToPoints_management("c:/data/photos", "c:/data/city.gdb/photo_points_no_attach_1", "", "ONLY_GEOTAGGED", "NO_ATTACHMENTS")
<Result 'c:\\Data\\City.gdb\\photo_points_no_attach_1'>
>>> arcpy.GeoTaggedPhotosToPoints_management("c:/data/photos", "c:/data/city.gdb/photo_points_no_attach_all_Photos", "c:/data/city.gdb/Invalid_Photos_Table", "ALL_PHOTOS", "NO_ATTACHMENTS")
<Result 'c:\\Data\\City.gdb\\photo_points_no_attach_all_Photos'>

0 Kudos
1 Solution

Accepted Solutions
Zeke
by
Honored Contributor

May have found the answer to this problem. Besides adding a PYTHONPATH environmental variable, I disabled background processing in Geoprocessing > Options. So far, the tools appear to run ok from the toolbox. Thanks Dan & Rebecca.

View solution in original post

8 Replies
DanPatterson_Retired
MVP Emeritus

they worked... they just aren't what you were expecting... have a read first Result—Help | ArcGIS for Desktop 

0 Kudos
Zeke
by
Honored Contributor

Yes, they worked in the Python window, and in Idle, but not from the toolbox. See the attached png above. Failed to execute.

I'm thinking it's a path problem, but no luck in fixing it.

0 Kudos
RebeccaStrauch__GISP
MVP Emeritus

Greg, is this a custom tool?   If so, are you using import to load all the mods needed in your script?  Looks like is at least missing numpy or isn't finding numpy.

0 Kudos
Zeke
by
Honored Contributor

No, this is a tool from Arc Toolbox - Data Management > Photos > Geo Tagged Photos To Points. Also happens on several other tools, such as Table To Excel.We're working on a Citrix VDI terminal. The tools do work on regular PC boxes, as well as in the Python window and Idle in Citrix.

My first thought is that it's a path issue, but haven't been able to resolve it that way. Tried setting both PATH and PYTHONPATH, no luck.

With PYTHONPATH set to C:\Python27\ArcGIS10.3\Lib\site-packages, still errors out, but a different message:

 

Messages

Executing: GeoTaggedPhotosToPoints C:\Data\Photos C:\Data\City.gdb\photo_points_path C:\Data\City.gdb\Invalid_Photos_Table_path ONLY_GEOTAGGED NO_ATTACHMENTS

Start Time: Wed Aug 24 10:16:21 2016

Running script GeoTaggedPhotosToPoints...

updateParameters Syntax Error: Runtime error

Traceback (most recent call last):

  File "c:\program files (x86)\arcgis\desktop10.3\ArcToolbox\Toolboxes\Data Management Tools.tbx#GeoTaggedPhotosToPoints_management.UpdateParameters.py", line 1, in <module>

  File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\__init__.py", line 24, in <module>

    from arcpy.toolbox import *

  File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\toolbox.py", line 359, in <module>

    from .management import Graph, GraphTemplate

 File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\management.py", line 26, in <module>

    import _management

  File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\_management.py", line 14, in <module>

    import _graph

  File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\_graph.py", line 27, in <module>

    import numpy

  File "C:\Python27\ArcGIS10.3\Lib\site-packages\numpy\__init__.py", line 137, in <module>

    import add_newdocs

  File "C:\Python27\ArcGIS10.3\Lib\site-packages\numpy\add_newdocs.py", line 9, in <module>

    from numpy.lib import add_newdoc

  File "C:\Python27\ArcGIS10.3\Lib\site-packages\numpy\lib\__init__.py", line 4, in <module>

    from type_check import *

  File "C:\Python27\ArcGIS10.3\Lib\site-packages\numpy\lib\type_check.py", line 8, in <module>

    import numpy.core.numeric as _nx

  File "C:\Python27\ArcGIS10.3\Lib\site-packages\numpy\core\__init__.py", line 5, in <module>

    import multiarray

ImportError: DLL load failed: %1 is not a valid Win32 application.

 

Failed to execute (GeoTaggedPhotosToPoints).

Failed at Wed Aug 24 10:16:21 2016 (Elapsed Time: 0.03 seconds)

0 Kudos
RebeccaStrauch__GISP
MVP Emeritus

In case it is an install issue for ArcGIS 10.3 on the Citrix VDI terminal, tagging ArcGIS for Desktop Installation support  

I know when we were trying to updating our Citrix XenApp to 10.3 (from 10.2.2) we had issues because we needed a newer version of XenApp.  Might want to rule that out ArcGIS 10.3.x for Desktop system requirements—Help | ArcGIS for Desktop 

Zeke
by
Honored Contributor

Thanks Rebecca, that's very helpful. I'll pass that along to the IT techs.

0 Kudos
Zeke
by
Honored Contributor

May have found the answer to this problem. Besides adding a PYTHONPATH environmental variable, I disabled background processing in Geoprocessing > Options. So far, the tools appear to run ok from the toolbox. Thanks Dan & Rebecca.

RebeccaStrauch__GISP
MVP Emeritus

Background processing is always a good thigk to check.  Interestingly enough, the tools I'm working on that need to work from a local machine (instead of the server where data is) were only working in background processing last week.  Then it stopped working altogether (which I wanted to blame on a network upgrade...which we weren't told the specifics).  It looks as if it was may be a timing issue with the remote machine saying the command was complete when it was not (or was too slow releasing the .lock), so the python script sent the next command which made it crash.  Was driving me nuts. 

In searching for other things to try, I found a post on testing to make sure a step had completed.  Interesting, but a little overkill for what I needed.  What I did pull out of it was

time.sleep(10)

which I stuck right before the crash point.  Fixed it.  10 seconds might be too long for my purposes, but not worth the time to test to save a few seconds. 

Anyway, not sure if with Citrix VM there might be a network lag, but something worth keeping in mind in case you run into any other issues.  Now my addin tool works on the local machine, with the data on the server (VM "somewhere").  With IT starting to lock down direct login access to some of our servers, that was the goal.

...at least my desktop it still physical....world goes round-and-round....back to "mainframes" (remote/VM/clouad) and "dumb-terminals" (VM machines).  Of course, the dumb-terminals are much smarter than the screen/keyboard of the past. 

0 Kudos