Select to view content in your preferred language

Runtime Error when trying to use arcgisscripting

1343
7
07-12-2011 12:12 PM
JohnRogers-Cotrone
Emerging Contributor
Simple code I am using:

-----------------------------
import arcgisscripting
gp = arcgisscripting.create(9.3)
print gp.Usage("Buffer_analysis")
-----------------------------

I get this error:
----------------------------------------------
Traceback (most recent call last):
   File "E:/Cotrone/python/script1.py", line 3, in <module>
      print gp.Usage("Buffer_analysis")
RuntimeError: NotInitialized
----------------------------------------------

No real goal with this script other than to see the Usage function work. I get the same error when I use gp.ListFeatureClasses(), and gp.Workspace = "some path". I am on a windows machine, using v9.3.1, IDLE, and python 2.5. Not sure what other details might be useful. Any suggestions why I get this error? If anyone has ideas or needs more info let me know. Relative novice here. Thanks!
Tags (2)
0 Kudos
7 Replies
BruceNielsen
Frequent Contributor
What happens if you try
import arcgisscripting
gp=arcgisscripting.create(9.3)
dir(gp)

You should see something similar to the attachment, except I'm using v9.2 & PythonWin.
0 Kudos
JohnRogers-Cotrone
Emerging Contributor
Nothing comes up in the Python Shell window. I also tried:

print dir(gp)

but then all I got was:

[]



I'm not specifically interested in the usage method. My main concern is that none of the methods or properties supported when creating the geoprocessor seem to work. I always get the same error saying "Not Initialized" whichever one I try to use.
0 Kudos
JohnRogers-Cotrone
Emerging Contributor
Does it matter where I am running the script from? I saved it to a random folder on my local E drive but python is located on the C drive:

C:\Python25

There is a folder in the Python25 directory named "Scripts" that I tried to save it to but I don't have permission to do so (this is a computer at work). Is this possibly a similar problem like you would encounter in Matlab where you either have to be pointing to the directory where the files are located to run them or you have to have them saved in your list of paths?


Thanks.
0 Kudos
JasonScheirer
Esri Alum
"NotInitialized" is a licensing issue. Does ArcMap open correctly?
0 Kudos
JohnRogers-Cotrone
Emerging Contributor
Arc starts fine but we have a lot of security restrictions so I am guessing this might be the issue now that you have mentioned licences. I will contact our IT department. Thanks.
0 Kudos
PawanVuppala
Frequent Contributor
Arcpy acts strangely on our ArcInfo Machine sometimes but after a logoff/login will fix it always.

-Pawan Vuppala
Arc starts fine but we have a lot of security restrictions so I am guessing this might be the issue now that you have mentioned licences. I will contact our IT department. Thanks.
0 Kudos
JohnRogers-Cotrone
Emerging Contributor
I've tried all sorts of logging off and restarting hyjinks. nothing changes. One thing I just realized that I didnt mention, I am checking out an Arc licence rather than using software fully installed on my machine. I have been told by people here at work that that might be an issue. Is there something I need to add to the code because of this? I seem to remember seeing a command on one of these forums for checking out licences for the individual toolboxes so maybe I need something similar for Arc in general?


Thanks.
0 Kudos