PermissionError: [Errno 13] Permission denied: 'C:/XXXX' windows 10

I just installed Windows 10 on this machine. I previously had no problem. Running the application as admin makes no difference.

I am getting this error:

Traceback (most recent call last):
File "C:\Users\xxxx\AppData\Local\Programs\Python\Python37-32\lib\site-packages\IPython\core\interactiveshell.py", line 3291, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-8a5ffd39cbb3>", line 1, in <module>
runfile('C:/Users/xxxx/test', wdir='C:/Users/xxxx')
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.5\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.5\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 11, in execfile
stream = tokenize.open(file) # @UndefinedVariable
File "C:\Users\xxxx\AppData\Local\Programs\Python\Python37-32\lib\tokenize.py", line 447, in open
buffer = _builtin_open(filename, 'rb')
PermissionError: [Errno 13] Permission denied: 'C:/Users/xxxx/test'


I'm at loss for a solution.

I'm admin, running pycharm as admin... what else does it want?

 

0
9 comments

Hi,

When do you get this error? Upon PyCharm lauch, on code execution, or any other action? If it's on code execution, does it happen with any script? 

0
Avatar
Permanently deleted user

Hi,

The error was due to the script path not being the .py script. For some reason I managed to not do this mistake for a while...

0
Avatar
Permanently deleted user

I get the same error using PyCharm 2020.1.20(Professional Edition). Please explain what "script path not being the .py script" means and how I can fix the issue. I'm a student and Google has not been my friend when it comes to finding a solution to this problem and running as administrator hasn't helped. My script works fine from the command line and fails with the following error in PyCharm. Any help would be greatly appreciated!

 

PyDev console: starting.
Python 3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)] on win32
runfile('C:/Users/student1/PycharmProjects/Learningdatabaseconnections', wdir='C:/Users/student1/PycharmProjects')
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Program Files\JetBrains\PyCharm Professional Edition with Anaconda plugin 2020.1.2\plugins\python\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "C:\Program Files\JetBrains\PyCharm Professional Edition with Anaconda plugin 2020.1.2\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 11, in execfile
stream = tokenize.open(file) # @UndefinedVariable
File "C:\Users\student1\miniconda3\lib\tokenize.py", line 447, in open
buffer = _builtin_open(filename, 'rb')
PermissionError: [Errno 13] Permission denied: 'C:/Users/student1/PycharmProjects/Learningdatabaseconnections'

0
Avatar
Permanently deleted user

I too have same error

0

Make sure your run configuration (Run | Edit Configurations...) points to the script you want to run.

0
Avatar
Permanently deleted user

Create a __init__.py in the outermost part having your main folders of code...run that __init__.py....it fixed for me

0
Avatar
Permanently deleted user

Call ur code from...__init__.py

0

 i have thesame problem

the run configuration int thcharm is ok
what did you write  in __init__.py?

0

I had the same issue after changing python directory. Then I changed interpreter setting to neww python directory then 'Run' the code from the Menu and selected 2nd 'Run' option or you can just use shortcut as Alt+Shift+F10' and a small window appears with your code file name then select the filename which you cant to Run.

This resolved my issue!

0

Please sign in to leave a comment.