I have been developing a script to automate my ArcPad checkin/checkout processes. My problem is that I am having trouble getting arcpy to recognize the ArcPad tools from the command line. From the example below you can see the specific error I'm getting. There is however some recognition that the tools exist as the help window actively shows the tool and parameters, giving help suggestions while you type as it would for any other tool. I have also followed the recommendations from this post:
Python scripting for ArcPad Checkin
I have about 100 checkin/checkouts to perform which is why I'd rather automate the process.
Example:
>>> arcpy.ArcPadCheckout_ArcPad("points_2015","","","","checkout_points.axf")
Runtime error
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files (x86)\ArcGIS\ArcPad10.0\DesktopTools10\ArcPad Tools.tbx", line 66, in ArcPadCheckout
AttributeError: Object: Tool or environment <ArcPadCheckout_ArcPad> not found
>>>
Attempt from example given below, similar error message:
>>> import arcpy
>>> from arcpy import env
>>> env.workspace="H:/path_to_my_geodatabase.gdb/"
>>> arcpy.AddToolbox(r"C:\Program Files (x86)\ArcGIS\Desktop10.1\ArcToolbox\Toolboxes\ArcPad Tools.tbx")
<module 'ArcPad' (built-in)>
>>> arcpy.ArcPadCheckout_ArcPad("points_2015","","","","checkout_points.axf")
Runtime error
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\program files (x86)\arcgis\desktop10.1\ArcToolbox\Toolboxes\ArcPad Tools.tbx", line 66, in ArcPadCheckout
AttributeError: Object: Tool or environment <ArcPadCheckout_ArcPad> not found
>>>
2 Answers 2
ArcPad Checkout from python command line works in arcgis 10.1, but you need to add arcpad toolbox with arcpy.AddToolbox()
.
this is a working sample script, in this script i pass the path of the axf as first argument in commande line:
import arcpy , sys
arcpy.env.overwriteOutput = True
arcpy.AddToolbox(r"C:\Program Files (x86)\ArcGIS\Desktop10.1\ArcToolbox\Toolboxes\ArcPad Tools.tbx") ##adding arcad toolbox
path_axf = sys.argv[2]
arcpy.ArcPadCheckin_ArcPad(path_axf, "", "")
There is a bug for this - NIM102547 - ArcPad tools fail to work in Python outside of ArcMap. It's been found in 10.2.1 but there's no reason why the behaviour should be different in previous versions.
As an alternative, you can run your script as a script tool or from the Python window.
Also, as @om_henners says, it's not a good idea to use combinations of different versions of ArcPad/ArcGIS for Desktop. I've experienced many issues doing this - in 10.0 at least, even combinations of different service packs would cause problems, maybe the 10.2 ArcPad tools are more stable.
Explore related questions
See similar questions with these tags.
ArcPad Data Manager
extension?