Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the reason of this errror: "PermissionError: [WinError 5] Access is denied"

I try to run this example code on Pycharm2018.3.3, it didn't work out. But the same code can run on the IDLE without any error.

My environment is Python3.7 + windows10.

from multiprocessing import Process, Queue

def f(q):
    q.put([42, None, 'hello'])

if __name__ == '__main__':
    q = Queue()
    p = Process(target=f, args=(q,))
    p.start()
    print(q.get())    # prints "[42, None, 'hello']"
    p.join()
Process Process-1:
Traceback (most recent call last):
  File "C:\Users\WYM\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\process.py", line 297, in _bootstrap
    self.run()
  File "C:\Users\WYM\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\process.py", line 99, in run
    self._target(*self._args, **self._kwargs)
  File "E:\Spider2\ControlNode\test.py", line 4, in f
    q.put([42, None, 'hello'])
  File "C:\Users\WYM\AppData\Local\Programs\Python\Python37-32\lib\multiprocessing\queues.py", line 82, in put
    if not self._sem.acquire(block, timeout):
PermissionError: [WinError 5] Access is denied.
like image 262
WYM Avatar asked Jan 14 '19 06:01

WYM


People also ask

How do I fix 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 you have. Click Edit, click your name, select the check boxes for the permissions that you must have, and then click OK.

Can't install packages due to an Oserror WinError 5 access is denied check permissions?

The error "Could not install packages due to an EnvironmentError: [WinError 5] Access is denied" occurs when we don't have the necessary permissions to install a package. To solve the error, run the command with the --user option, e.g. pip install tensorflow-gpu --user .

What is Win error 5?

Error 5: Access is denied is primarily a software installation error message. Consequently, when this error message pops up, users can't install certain software. The cause is usually account permissions.


1 Answers

This issue may be a known bug with Python 3.7.2

I was experiencing the same issue and fixed it by creating a new virtual environment with Python 3.7.0

like image 97
Sean True Avatar answered Oct 21 '22 03:10

Sean True