Select to view content in your preferred language

Scheduled Python task failing on 'import arcgisscripting'

1454
11
08-18-2011 12:05 PM
MikeLouwrens
Frequent Contributor
I have a scheduled task that runs a batch file running a python script to add fields into my SDE database (runs at about 2am).

If I run the batch file manually, the python script runs and completes fine.

However when the scheduled task runs the batch file, the python script starts, but it fails when it tries to import the arcgisscripting module.  I don't understand why it's failing here, as it works fine when the batch is manually run, but fails when it is scheduled.  I have other scripts scheduled overnight that run python scripts (which include arcgisscripting) and these run fine, so I'm a little confused as to why this one is failing every morning.

Any suggestions?

Thanks,
Mike.
Tags (2)
0 Kudos
11 Replies
ChristopherFricke1
Deactivated User
How are you kicking off the script manually?  Through Idle, doubleclicking or in CLI via python xxxx.py ?

If you have multiple versions of python installed the arcgisscripting library might not be in the one that the scheduled task is hitting.

Probably a shot in the dark, but worth checking out.
0 Kudos
deleted-user-1T_bOHag6M8d
Deactivated User
You may be defaulting to the wrong version of python in your script. For example, I have multiple installations of Python on my machine. If I just call "python" in my command line, it opens the version at C:\Python27 which doesn't have the ArcGIS Python modules. I have to call the full path name to the ArcGIS Python installation in my command prompt (C:\Python26\ArcGIS10.0\python.exe). Of course, at 9.3.1 yours will be a different path than mine.
0 Kudos