1
votes

I am trying to run a python script that downloads qualtrics survey responses and stores it as a CSV. As part of the script it calls zipfile.zipfile. When i run the program inside of VS Code Terminal window it downloads and unzips the file just fine. However when I run the script in Windows Task Scheduler i run into this error.

<class 'PermissionError'>
Traceback (most recent call last):
  File "C:\Users\sdr-research\Dropbox (PCC)\SDR6\Qualtrics_Data\QualtricsSurveyResponses\mindshareResponsesPull.py", line 54, in <module>
    zipfile.ZipFile(io.BytesIO(requestDownload.content)).extractall("C:\\Users\sdr-research\Dropbox (PCC)\SDR6\Qualtrics_Data\QualtricsSurveyResponses")
  File "C:\Python36\lib\zipfile.py", line 1501, in extractall
    self._extract_member(zipinfo, path, pwd)
  File "C:\Python36\lib\zipfile.py", line 1555, in _extract_member
    open(targetpath, "wb") as target:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\sdr-research\\Dropbox (PCC)\\SDR6\\Qualtrics_Data\\QualtricsSurveyResponses\\Mindshare English v2.1.csv'

I am running python 3.6, windows 10, i have tried changing the user permissions from my logged in account the administrator's, placing the file's path in as the program to run, placing python.exe as the program to run and the file's path as the first argument with and without the folder the file is located in as the "start in" parameter. I make sure when i put in the file name into the task scheduler i put quotations around the path because there is a space in the path.

Any ideas?

1
Does the scheduler run as your own user? If not, this could be the source of your troubles.Burhan Khalid
I have tried using both my own account and the administrator account.Abram
Have you solved this? Also getting the errorJohnAndrews
I did solve it, can't remember the exact solution. It was something silly like forward slash vs. back slashes, copying and pasting the file path vs. navigating to the file using a GUI. Sorry, I wish i could remember :/. I do remember it was something stupid simple.Abram

1 Answers

1
votes

I had a similar issue with a python script not being able to create a log file when opened with task scheduler (when I scheduled Selenium to do a daily browser task). It was solved by checking "Run with the highest privileges" in the General tab of the task.