I can use ArcGIS Desktop model builder to leverage the ArcPad Check In Tool. When I run the model it executes successfully. When I export the model as python I get this code:
import arcpy
# Local variables:
Test02_axf = "C:\\aWorkspace\\ESA\\ArcPad\\AXFs\\Test02.axf"
# Process: ArcPad Check In
arcpy.ArcPadCheckin_ArcPad(Test02_axf, "", "")
However, when I run this code in the python window I get:
Runtime error
Traceback (most recent call last):
File "<string>", line 8, in <module>
AttributeError: 'module' object has no attribute 'ArcPadCheckin_ArcPad'
And yes indeed arcpy has no function named ArcPadCheckin_ArcPad. So model builder must be exporting erroneous code.
Does someone out there know what the issue is here? Is there really anyway to do this operation with python?
-
This article says to do essentially what you've done: support.esri.com/es/knowledgebase/techarticles/detail/35586 I guess there just isn't any ArcPad module access through Python?Roy– Roy2012年09月13日 16:36:02 +00:00Commented Sep 13, 2012 at 16:36
-
It's supposed to work. However the GP environment has changed over the different ArcGIS releases and there's workaround to get the ArcPad tools to reappear. You'll need to tell us which version of ArcGIS that you have so we can best help you.Stephen Quan– Stephen Quan2012年09月13日 23:31:04 +00:00Commented Sep 13, 2012 at 23:31
-
ArcGIS 10.1, ArcPad 10.0.4rgwozdz– rgwozdz2012年09月14日 17:08:13 +00:00Commented Sep 14, 2012 at 17:08
2 Answers 2
As of ArcGIS Desktop 10.0 the registration and discovery of the ArcPad tools has changed requiring a workaround. Both ArcGIS Desktop 10.0 SP3 and the ArcPad 10.0 installer implements this workaround.
If you have an older version of ArcGIS Desktop 10.0 you will be lacking the workaround.
If you have ArcGIS Desktop 10.1 you will also be lacking the workaround because the registration and discovery of tools have changed but such change will not work for the ArcPad 10.0 tools.
You need to perform the workaround manually:
- Open File Explorer
- Navigate to Desktop installation (e.g. C:\Program Files\ArcGIS\Desktop10.0)
- Navigate to the arcpy\arcpy subfolders
- Locate
__init__.py
- Edit it in a text editor
- Ensure the following
# Conditional import of arcpad tools
script is present (see python code snippet below): - Navigate to your Python installation folder (i.e. C:\Python27)
- Locate your site-packages folder (i.e. C:\Python27\ArcGIS10.1\Lib\site-packages)
- Ensure arcpad.py exists, if not copy it from your ArcPad installation folder (i.e. C:\Program Files\ArcGIS\ArcPad10.0\DesktopTools10\arcpad.py)
- Restart ArcGIS Desktop and
voila
the ArcPad tools should be accessible in python
Here's the code snippet required for the conditional installation of ArcPad and it should be included in __init__.py
(place it after the conditional import of mobile tools and production tools):
# Conditional import of arcpad tools
try:
from . import toolbox
import arcpad
toolbox.arcpad = arcpad
if not hasattr(arcpad, '__all__'):
arcpad.__all__ = []
if not hasattr(toolbox, '__all__'):
toolbox.__all__ = []
for toolname in getattr(arcpad, '__all__', []):
toolbox.__all__.append("%s_%s" % (toolname, arcpad.__alias__))
setattr(toolbox, "%s_%s" % (toolname, arcpad.__alias__), getattr(arcpad, toolname))
from toolbox import *
del toolname
except ImportError:
pass
arcpy doesn't work, but going back to the old gp = arcgisscripting.create() does:
import arcgisscripting
# Create the Geoprocessor object
gp = arcgisscripting.create()
# Local variables:
Test02_axf = "C:\\aWorkspace\\ESA\\ArcPad\\AXFs\\Test02.axf"
# Process: ArcPad Check In
gp.ArcPadCheckin_ArcPad(Test02_axf, "", "")
Someone forget to add this to arcpy?
Explore related questions
See similar questions with these tags.