Hello,
I'm having an issue trying to automate a python script that relies heavily on arcpy/ArcGIS. I have a functioning version of the script that runs perfectly in the ArcMap Python module, that continually fails when trying to translate it to something what will run from a batch file. I'm trying to set it up so that Windows Task Scheduler can grab it. What I've come to notice is that any function that has a table as an output (Table to Table, Copy Rows, Frequency Count, ect) fails when running from the batch. I've been copying and pasting these directly into the desktop version with 100% success so it doesn't seem like there are typos. Has anyone ever run into this before? Or is there a way to automate the script to run in ArcMap rather than python.exe? I'm working on Windows Server 2012 R2. Thank you!
Solved! Go to Solution.
Hi James,
It looks like there was a lock that was screwing things up. I had an ArcMap window open for troubleshooting and I guess that prevented tables from functioning properly. For whatever reason spatial feature classes were unaffected. Than you for your help!
What does your .cmd or .bat file look like?
What does the error say exactly when executed from the batchfile? (you should have some sort of logging in order to capture these types of things).
Hi James,
As for my batch file all I have is : "start C:\Python27\ArcGIS10.4\python.exe E:\Script_Folder\Script_File.py"
I have logging set up with print statements before and after the line where its happening (right now I'm stuck on the Frequency Analysis). I always get the print statement right before the function then it fails. Are there more specific types of log functions that would be more helpful to use in this situation?
I have this line in a Try/Except function, so I always get the fail error I have in the "Except" section
I think if you right-click the batch file and run as admin it should print out the execution and any errors. Perhaps remove any try/except blocks and just let the error print out in the command window to see if you can get an actual error number to show.
Hi James,
It looks like there was a lock that was screwing things up. I had an ArcMap window open for troubleshooting and I guess that prevented tables from functioning properly. For whatever reason spatial feature classes were unaffected. Than you for your help!