Running "path/python.exe" as the "Program/script" with "python path/file" as the argument.Running the python script from a batch file.Alternating "Run with highest privileges".Alternating "Run only when user is logged in" and "Run whether user is logged in or not".So, just on a lark, I moved the "connectionfilename.sde" from its current location on a network drive to a location on the C: drive (the same folder the "scriptname.py" file was in). After writing try/except conditions and examining the description of my workspace (established using a connection file) I determined that Arcpy was indeed loading correctly and that the problem was Arcpy was not establishing a connection to my database using my connection file when my script was run from the scheduler. This is really a hassle that it works when I test it and I think I'm just an "Adding it to the scheduler" step away from being done and then that's the part the bails! When I run it in the Task Scheduler I get information telling me that the list returned from the arcyp.ListFeatureClasses command is empty:Īnother weird thing is that the task always says "Running" in the scheduler even though it has reached the end of the script.Īny thoughts would be appreciated. The below image shows the log file I write in the above code: bat file: "C:\Users\?\AppData\Local\ESRI\conda\envs\arcgispro-p圓-clone1\python.exe" "C:\Scripts\ProjectName\ScriptName.py" When I run the script from the command line using a. #but since the names are fully qualified we have to account for other leading charactersįeatClasses = arcpy.ListFeatureClasses('*Spatial*','','')į.write("Feature Class List acquired successfully")į.write("Updating fields to use appropriate case in FC: " + fc + " :"+str(())) #all of the feature classes we want to udpate all start with the word "Spatial" Please see code and images below: import arcpyį = open ('C:\Scripts\CartegraphIntegration\COJNPDESIntegrationDBLog.txt', 'a+')į.write("**********Program Started :"+str(())+"**********")ĬGIntegrationsde = r"z:\Not\A\RealPath\connection.sde"į.write("Workspace set successfully: " + CGIntegrationsde) bat file that runs the script in Windows (10) Task Scheduler, it fails to return a list of FC names. bat file to trigger it, it runs great and completes successfully. When I run this script from the command line using a. I have a pretty simply python script that steps through all of the feature classes in an enterprise GDB having a certain name.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |