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

2840
12
Jump to solution
09-10-2020 05:54 AM
MichaelTorbett
Occasional 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

12 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
Occasional 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.

JoeBorgione
MVP Esteemed Contributor

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

That should just about do it....
0 Kudos
davehorsey1
New Contributor III

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
Occasional Contributor II

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
JeffHaupt
New Contributor II

I notice this topic keeps getting updated with different users having the same issue and trying different approaches to the problem with mixed results.  Has anyone from ESRI ever acknowledged this issue and recommended a certain approach that entities should take to handle the issue of Scheduled Tasks that rely on Arcpy to run? 

0 Kudos