Select to view content in your preferred language

Scheduled Model won't export file

709
6
09-21-2023 06:40 AM
Labels (1)
Savannah2019
Occasional Contributor

I have a model that I have scheduled to run every day. The first thing that it does is calculate today's date and export a copy of the imported file with today's date. When ArcPro is open and I run it, there is no issue. When it's closed and the schedule starts it, it will not export the file. There's no error given and the rest of the model runs with no issue, but it will not export the file.

I've tried the copy tool to a csv, the export tool to a csv (this one will export the file, but after about a minute, it disappears), and table to excel tool to a xlsx. 

I imagine it has something to do with using today's date as the file name, but I really need that information in it. 

Please help!

0 Kudos
6 Replies
RhettZufelt
MVP Notable Contributor

Are you running the scheduled task when not logged in?  Where are you trying to export the file to?

When running as a scheduled task and not logged in, any user mapped drives will not be available.

If this is the case, you can export to a network drive (UNC, not mapped), or a local drive.

Not sure if this helps, but is often the cause of it working when logged in, but not when scheduled.

 

R_

0 Kudos
Savannah2019
Occasional Contributor

No, I'm logged in. Since I've been trying to fix this issue, I'm testing it by setting it to run in a couple minutes and then closing arcpro. But my computer is still on. 

The file is being saved to a network drive however.

Edit- I just tested trying to save the file to a local file and the same thing happened, which is to say, nothing.

0 Kudos
RhettZufelt
MVP Notable Contributor

Are you referencing 'Layers' (from the TOC) from a drop-down list in any of the tools in the model?  If so, Pro will 'see' them, but with Pro closed, a script will not.  You can, instead of the drop-down, click the folder icon and browse/select the actual data source. 

R_

 

0 Kudos
Savannah2019
Occasional Contributor

No, it's actually the very first step in my model, so it's grabbing it directly from the source.

0 Kudos
RhettZufelt
MVP Notable Contributor

That's the couple things I can think of off the top of my head. 

Have you ran it in Pro, went to the Analysis History and saved it as a python file?  This will output the python used being the model and could make it easier to follow and see what is going on.

If you can't figure it out from that, if you could post the relevant code, could dive into it deeper.

R_

0 Kudos
Savannah2019
Occasional Contributor

So I ended up playing with it some more and I found the issue- For the next step after the export, I had it set up with a precondition of the export finishing first. That was the problem. I removed the precondition and it started working. It's not ideal, but it's working

0 Kudos