Select to view content in your preferred language

Last run result message 0xF6 when trying to run a python script using Windows Task Scheduler.

10341
31
Jump to solution
09-10-2020 05:54 AM
MichaelTorbett
Frequent Contributor

I am running several python scripts on a schedule on a virtual machine that has ArcGIS Pro 2.6.1 installed. I am using the python.exe from my Pro python environment to run all of the scripts in task scheduler. However ever since ArcGIS Pro version 2.5.2, I have been getting the message 0xF6 in the last run results. The crazy thing is that this happens sporadically. Sometimes the tasks run fine and other times they don't. All of my python scripts run fine by themselves. 

Has anyone else had this issue and know of a fix? 

Thanks,

Michael 

1 Solution

Accepted Solutions
MichaelVolz
Esteemed Contributor

I ran into the same problem using Pro 2.7.3.  Switching from python.exe to pythonw.exe seems to have resolved the issue.

View solution in original post

31 Replies
by Anonymous User
Not applicable

We just started experiencing the same thing. 

We are running Pro 2.6.1 on a VM running Windows Server 2019 Datacenter. The scripts have been running fine for months, and now they are sporadically getting the 0xF6 last result message. We have a few scripts which run nightly. Each night a different script gets the message, but the others run successfully. 

Have you found any solution?

0 Kudos
MichaelTorbett
Frequent Contributor

Hey Brook,

What I ended up doing was importing my python scripts into an ArcGIS Pro tool box and saving them as geoprocessing  tools. Then I scheduled them to run nightly through Pro instead of Windows Task Scheduler and now they are running fine.

The funny thing is scheduling geoprocessing tasks through Pro just adds a task in Windows Task Scheduler. I have no idea why it working this way instead of directly through Windows Task Scheduler. My IT Department is stumped as well, but things are fine now.

I hope this helps.

MichaelVolz
Esteemed Contributor

Can you provide more details on how you were able to accomplish this task as I would like to try to move ArcMap scripts to Pro and maybe I can bypass using Windows Task Scheduler in the future with this same move?

Did any of your scripts involve stopping services for tasks such as Rebuilding address locators?

0 Kudos
MichaelVolz
Esteemed Contributor

I ran into the same problem using Pro 2.7.3.  Switching from python.exe to pythonw.exe seems to have resolved the issue.

MichaelVolz
Esteemed Contributor

So this might have solved the problem in Pro 2.7.3 to use pythonw.exe (Not entirely sure it did), but the problem exists again at Pro 2.9.x thru 3.3.x where using pythonw.exe does not resolve the problem.  I currently have a Windows 2019 Server where AMP anti-virus software is disabled and the python script is not being skipped.  I'm hoping my org can figure how to configure AMP exceptions to get it to stick work without completely turning off AMP anti-virus software which would be a severe security risk.

0 Kudos
JoeBorgione
MVP Emeritus

I've always found that windows task scheduler works great until it doesn't...   

That should just about do it....
0 Kudos
davehorsey1
Regular Contributor

Hi all. I also ran into this issue recently, and we couldn't put our finger on why it was failing. We ended up going down the same route as Michael Torbett and noticed that the scheduled task in Pro was using the pythonw.exe, not python.exe. We reverted our original task scheduler task to run pythonw.exe and since then it's been working without any problems.

Hope this helps.

ISP_graynic
Frequent Contributor

I was having this issue and getting this same error code in Task Scheduler but was properly running pythonw.exe as suggested. I found changing the setting back to "Run only when user is logged in", caused it to work. Before I had it set to run even when the user is logged out. It must be some sort of a permissions issue. 

JaredPilbeam2
MVP Regular Contributor

@MichaelVolz 

My script wouldn't run via Windows Task Scheduler with any of the above suggestions, until I tried running it from Pro's scheduler. I loosely followed this Pro help page: https://pro.arcgis.com/en/pro-app/latest/help/analysis/geoprocessing/basics/schedule-geoprocessing-t...

Basically, I saved my stand-alone script as a script tool with no parameters. Before you hit Run, set up the schedule. I added a bunch of arcpy.AddMessage() print statements so I could see how it was progressing.

JaredPilbeam2_0-1643754388837.png

As MichaelTorbett said, Pro actually uses Windows Task Scheduler to run the geoprocessing tool. In the Task Scheduler, under the Actions tab, it used the pythonw.exe file as the Program/script and the argument was stuffed away here: "C:\Users\me\AppData\Local\ESRI\ArcGISPro\Geoprocessing\ScheduledTools\WasteRecyclingReport_02012022_0325PM\task.py"

0 Kudos