Scheduled Python task failing on 'import arcgisscripting'

687
11
08-18-2011 12:05 PM
MikeLouwrens
Occasional Contributor III
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
MathewCoyle
Frequent Contributor
Is your database doing something at that time? Backup, compacting etc? Other server/network things going on? Have you tried scheduling it for a different time? Have you tried scheduling your other scripts that do run to run at 2am to see if they fail then?
0 Kudos
MikeLouwrens
Occasional Contributor III
thanks for your reply.

The time is set aside for some scheduled tasks to happen on the server/database (12:30am-6am), no other tasks have any issues between this time, no matter what time they are run.  Nothing else is being done on the database or server at the same time.

That said, the script starts normally, but it doesn't even get to look at the database.  It is failing specifically at the "import arcgisscripting" right at the start of the script, it doesn't get far enough to connect to the database.  No error message is returned though.

Cheers,
Mike.
0 Kudos
MathewCoyle
Frequent Contributor
The only reason I can see for that to happen is if it can't access the license manager, or doesn't think you have rights to access it. Are you using 9.3.1?
0 Kudos
MikeLouwrens
Occasional Contributor III
The only reason I can see for that to happen is if it can't access the license manager, or doesn't think you have rights to access it. Are you using 9.3.1?
Yes we're using 9.3.1.  Could be the license manager, I'll look into that possibiltiy, however it does seem odd that my other scripts work fine.

The license manger is on a separate server, so there might be a connection issue happening somehow.

Is a license used when importing arcgisscripting?  Or only when you use it to run a geoprocessing tool?

Cheers,
Mike.
0 Kudos
MathewCoyle
Frequent Contributor
As soon as you import arcgisscripting it checks out a license. How many licenses do you have available? What may be happening is each script you are running that imports arcgisscripting is consuming a license and not releasing them when they are done.
0 Kudos
MikeLouwrens
Occasional Contributor III
We should have more than enough licenses, even if the previous scripts don't release them.

I have changed the scheduled tasks so that this one now runs earlier, and another runs later, to see if it is scheduled time related.  This might also highlight whether there are license availability issues etc.

Cheers,
Mike.
0 Kudos
MathewCoyle
Frequent Contributor
Good luck, let us know what you find.
0 Kudos
RandyKreuziger
Occasional Contributor III
Is the scheduled job running under a different user?  If so try logging in as that user and running it manually.  The scheduled user may not have rights to a license.
0 Kudos
MikeLouwrens
Occasional Contributor III
Is the scheduled job running under a different user?  If so try logging in as that user and running it manually.  The scheduled user may not have rights to a license.
I had wondered that, so I've checked - all the scheduled tasks are running as the same user (and is the same user I log into the server as when I test it manually).

Thanks for your suggestion.

Cheers,
Mike.
0 Kudos