问题
I have a .py file that reads integers from a separate csv , i just cant launch it from windows task scheduler, after 2 days and much frustration im posting here. A lot of similar questions have been posted but none are answered adequately for my case.
I have no problems launching other python files or exe's, the problem arises when the python file needs to read a csv. I have turned the file into a batch file, and i have also went through every possible permutation of administration and permission options, but still no cigar. The problem stems solely from the fact that the python needs to call from an external csv. Has anyone got an opinion, or a work-around?
Thanks.
回答1:
Assuming that you try this under the windows 7 Task-scheduler...
You may try the following:
- In the security options of your Task (1st page) ensure that you have selected the SYSTEM account. Tick the high privileges check box near the bottom of the dialog (i guess you already did that)
- check if the file can be accessed (write into it with notepad)
- try to call the executable from the python processor directly with your script-file as an argument (maybe something went wrong with the inheritance of access rights when windows calls the python processor; assuming that you linked the .py file in the Task Scheduler)
- check the execution profile of the python command processor and compare it to the ownership of the CSV file (does the csv file reside in a user-account folder and has therefor other access requirements the python process can provide ? example: csv owned by user X, Task is run as user Y)
- you may also try to create a new, empty textfile somewhere else (C:) and fill the content in from the CSV
greetings :)
来源:https://stackoverflow.com/questions/22516246/open-python-file-with-task-scheduler