-1

I have several python scripts that are running from the Windows Task Scheduler. When I execute the scripts manually, they create .csv files inside of a folder that I use for various reports. When I run the scripts through task scheduler, they will run, but they do not create the .csv files. I have them setup to run even when I am not logged on, and to wake the computer to run. Does anyone know why the .csv files are not being created?

JasonWH
  • 159
  • 1
  • 14
  • Are you using relative paths for your filenames? – Martijn Pieters May 20 '14 at 15:20
  • Kind of curious why I got the down vote. Inside the python script yes. I am using relative files names. The .csv's are inside the same folder as the Python scripts. Here is an example: `with open('myFile.csv', mode='wb') as F: F.write(output.encode('ascii', 'replace')) print("Done.")` – JasonWH May 20 '14 at 15:25
  • I didn't downvote, but your question is lacking information to diagnose the issue. I happen to have guessed right here, but others may have felt you should have provided that info up-front. – Martijn Pieters May 20 '14 at 15:30

1 Answers1

3

When running a task with Windows Task Scheduler, your 'current working directory', the location from which relative paths are resolved, is different from when you run a script manually.

Either set the current directory for the task, or don't use relative paths.

Community
  • 1
  • 1
Martijn Pieters
  • 889,049
  • 245
  • 3,507
  • 2,997