Select to view content in your preferred language

ArcGIS 9.3 python script in ArcGIS 10

1816
8
03-22-2012 06:38 AM
GaneshDevarajan
Deactivated User
Hello,

I need to use the following arcscript on a Linux box running ArcGIS Server 10 SP3

The script is for ArcGIS version 9.3. I am unable to run it in ArcGIS 10

http://resources.arcgis.com/gallery/file/geoprocessing/details?entryID=633F4ED8-1422-2418-88B7-3E373...


Any help is appreciated.
Tags (2)
0 Kudos
8 Replies
MichaelVolz
Esteemed Contributor
Ganesh:

Here are some changes you can make to this script:

Instead of

import arcgisscripting
import os, sys
gp = arcgisscripting.create(9.3)
gp.OverWriteOutput = 1

Use

import os, sys
import arcpy
import arcpy.mapping
from arcpy import env
arcpy.env.overwriteOutput = True


Instead of

featureClassA = gp.GetParameterAsText(0)

Use

featureClassA = arcpy.GetParameterAsText(0)


Instead of

dscB = gp.Describe(featureClassB)

Use

dscB = arcpy.Describe(featureClassB)


I hope this gets you started to see where you need to make changes in the rest of the code for v10.
0 Kudos
GaneshDevarajan
Deactivated User
Thank you Michael. I will give it a try.

Ganesh
0 Kudos
GaneshDevarajan
Deactivated User
Hi Michael,

I made the changes that you suggested and I get the following error..


bash-3.2$ . /usr/apps/arcgis/server10.0/python26/setenv_python.sh
bash-3.2$ python compare_feature_classes.py
Traceback (most recent call last):
  File "compare_feature_classes.py", line 28, in <module>
    import arcpy
  File "/usr/apps/arcgis/server10.0/python26/lib/python2.6/site-packages/arcpy/arcpy/__init__.py", line 17, in <module>
    from geoprocessing import gp
  File "/usr/apps/arcgis/server10.0/python26/lib/python2.6/site-packages/arcpy/arcpy/geoprocessing/__init__.py", line 14, in <module>
    from _base import *
  File "/usr/apps/arcgis/server10.0/python26/lib/python2.6/site-packages/arcpy/arcpy/geoprocessing/_base.py", line 14, in <module>
    import arcgisscripting
ImportError: libappinitializerlib.so: cannot open shared object file: No such file or directory


Also attached is the script that I made changes to.
0 Kudos
RDHarles
Regular Contributor
"Arc 9" scripts (gp) will work fine in "Arc 10" (arcpy).  You just won't be able to take advantage of any of the new arcpy functionality.
0 Kudos
GaneshDevarajan
Deactivated User
If I run the script without making any changes..I am getting the following error...


  File "compare_feature_classes.py", line 27, in <module>
    import arcgisscripting
ImportError: libappinitializerlib.so: cannot open shared object file: No such file or directory
0 Kudos
RDHarles
Regular Contributor
Do you have another computer you can try it on?
I have Arc 10 loaded on all our computers here (at least 8 of them) and doing a "import arcgisscripting" isn't an issue on any of them.
I have to assume your installation/computer is messed up somehow.  All I can tell you is that normally this will work.
0 Kudos
ChrisSnyder
Honored Contributor
You said you are running this on a Linux box... I don't have any experience with Server runninng on Linux, but can you start up a Python window (run Python.exe) and run the command:

import arcgisscripting
or
import arcpy
?

If not, this either indicates:
1. There is something wrong with your ArcServer/Python install
2. You can't run geoprocessing (gp/arcpy) scripts via ArcServer on Linux (I think you can though if I'm not mistaken??)

The error messages you get seem to hint at the 1st possibility.
0 Kudos
GaneshDevarajan
Deactivated User
Thank you Harles...

Its running...I was trying it on a Linux box and it was unable to find the libappinitializerlib.so.

Running the following script fixed it....
~arcgis/server10.0/servercore/.Server/init_server.sh
0 Kudos