Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WindowsError [error 5] Access is denied

I'm using the killableprocess package (built on top of subprocess) for running processes Whenever I run the "killableprocess.Popen(command)" piece of code in my script I get the following error:

File "killableprocess.py", line 157, in _execute_child   winprocess.AssignProcessToJobObject(self._job, hp) File "winprocess.py", line 37, in ErrCheckBool   raise WinError() WindowsError [error 5] Access is denied Exception TypeError: "'NoneType' object is not callable" in <bound method AutoHANDLE.__del__ of <AutoHANDLE object at 0x025D42B0>> ignored 

But when I run it from the python interactive console (python 2.6) it works fine. That probably means there are permission issues when I run this from the script, but I don't know how to solve them. I tried running the script from a cmd that I ran as administrator, but it didn't help. Tried looking for similar posts but didn't find any good solution. Hope to find some help here I'm running on Windows, specifically Windows 7 Ultimate x64, if it's any help.

thanks

like image 598
Serg Avatar asked Jun 09 '10 11:06

Serg


People also ask

How can I fix the access denied error?

Right-click the file or folder, and then click Properties. Click the Security tab. Under Group or user names, click your name to see the permissions that you have. Click Edit, click your name, select the check boxes for the permissions that you must have, and then click OK.

What is an error 5?

Last Modified on 02/14/2020 5:44 pm EST. Error Code 5 is a Windows error code that appears when the user does not have sufficient permission to access the requested file or location. It appears when the software was denied access to a location for the purposes of saving, copying, opening, or loading files.

How do I fix access denied in Python?

PermissionError: [errno 13] Permission denied occurs when someone tries to access a file from Python without having the necessary permissions. To fix this error, use the full chmod or chown command to change the permissions on the file to allow the correct user and/or squad to access the file.


1 Answers

I solved a similar problem I had by switching to the process directory (I was trying to use inkscape) and it solved my problem

import subprocess inkscape_dir=r"C:\Program Files (x86)\Inkscape" assert os.path.isdir(inkscape_dir) os.chdir(inkscape_dir) subprocess.Popen(['inkscape.exe',"-f",fname,"-e",fname_png]) 

Maybe switching to the process directory will work for you too.

like image 64
tjb Avatar answered Oct 01 '22 14:10

tjb