I'm having some trouble with using the data drive pages functionality in linux. Perhaps I'm missing something obvious here, so if anyone has successfully used this, I'd appreciate any comments.
Neither dataDrivenPages.currentPageID or dataDrivenPages.getPageIDFromName work on my system, but both work in Windows, using the same input data.
The issue can be recreated easily: Create a new mxd in ArcMap. Add some basic background layer for reference (World Map or whatever). Create a new polygon shapefile in same directory where mxd is. Add several polygons. Add an item name in the polygon's attribute table, and assign each polygon a text name (optional). Save changes to shapefile. Setup data driven pages on the mxd, using that name item as the index. Set MXD to save as relative pathname. Save mxd. Close ArcMap.
Open a shell window in the directory where the mxd is located. Start python, import arcpy and attempt to use the above python methods. The results on Linux vs Windows are below. Note the returned pageID should be the same as the "Box" number. Eg Box2 is pageID = 2. Also, on my system, the directory where everything is located is the same for linux and Windows; Windows runs in a virtual machine and accesses the directory as a network drive.
Linux (CentOS 5.6, 64-bit, ArcGIS Engine 10.0 SP2):
-----------------------------------------------------------
$ source /usr/local/arcgis/engine10.0/init_engine.sh
$ source /usr/local/arcgis/engine10.0/python26/setenv_python.sh
$ python
Python 2.6.5 (r265:79063, Apr 27 2010, 11:08:55)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import arcpy
>>> mxd = arcpy.mapping.MapDocument('Test.mxd')
>>> pageID = mxd.dataDrivenPages.getPageIDFromName('Box2')
>>> pageID
0
>>> mxd.dataDrivenPages.currentPageID = 2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/arcgis/engine10.0/python26/lib/python2.6/site-packages/arcpy/arcpy/arcobjects/_base.py", line 77, in _set
return setattr(self._arc_object, attr_name, ao)
ValueError: PageLayoutObject: Error in SetDataDrivenPageID
>>> quit()
-----------------------------------------------
Windows (Win7/64-bit, ArcGIS 10.0 SP2):
------------------------------------------------
>C:\Python26\ArcGIS10.0\python.exe
Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import arcpy
>>> mxd = arcpy.mapping.MapDocument('Test.mxd')
>>> pageID = mxd.dataDrivenPages.getPageIDFromName('Box2')
>>> pageID
2
>>> mxd.dataDrivenPages.currentPageID = 2
>>>
------------------------------------------------
Any clues as to whether I'm simply doing something wrong or this is a bug? I have had success doing many other operations on mxd's using ArcGIS Engine/Linux, but this particular method fails.