2

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?

3
  • 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
    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. Sep 13, 2012 at 23:31
  • ArcGIS 10.1, ArcPad 10.0.4
    – rgwozdz
    Sep 14, 2012 at 17:08

2 Answers 2

5

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:

  1. Open File Explorer
  2. Navigate to Desktop installation (e.g. C:\Program Files\ArcGIS\Desktop10.0)
  3. Navigate to the arcpy\arcpy subfolders
  4. Locate __init__.py
  5. Edit it in a text editor
  6. Ensure the following # Conditional import of arcpad tools script is present (see python code snippet below):
  7. Navigate to your Python installation folder (i.e. C:\Python27)
  8. Locate your site-packages folder (i.e. C:\Python27\ArcGIS10.1\Lib\site-packages)
  9. Ensure arcpad.py exists, if not copy it from your ArcPad installation folder (i.e. C:\Program Files\ArcGIS\ArcPad10.0\DesktopTools10\arcpad.py)
  10. 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
2

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?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.