Permission denied for .pyc file

0 votes

I have written a Python script in a file and tried to run it yesterday. It ran properly without any errors. Today I am trying to run the same script again but I am getting error telling

Permission denied: .pyc

I did not get error log so posted only the main error. How to solve this?

Feb 7 in Python by Dinesh

1 answer to this question.

0 votes

Did you run the python script as the same user who created it? I am guessing it could be permission issue because you have created it as a different user and running it as a different user. There are 2 solutions for this:

  1. Switch to the user who created the script, and run it
  2. Change the permission of the file and run it. 

You can change the permission using the chmod command:

$ sudo chmod 777 /path/to/pyc/file
answered Feb 7 by Omkar
• 67,620 points

Related Questions In Python

0 votes
1 answer

Need help extracting a schema to make use for an avro file in Python

Hi, nice question. So what I daily use ...READ MORE

answered Jan 10 in Python by Nymeria
• 3,520 points
0 votes
1 answer

Regarding pyc file in Python

When you run a Python script, Python ...READ MORE

answered Feb 7 in Python by Yogi
0 votes
1 answer

how to check for exceptions in a file?

try { if (!file.exists("TextFile1.txt")) throw ...READ MORE

answered Mar 20 in Python by Mohammad
• 3,060 points
+3 votes
7 answers

How can I rename a file in Python?

yes, you can use "os.rename" for that. ...READ MORE

answered Mar 31, 2018 in Python by DareDev
• 6,810 points
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 282 views
+4 votes
6 answers
0 votes
1 answer

formatting_info=true for xlsx file handling

There are 2 libraries used to handle ...READ MORE

answered Mar 19 in Python by Omkar
• 67,620 points
+1 vote
2 answers

Appending data to a file

First open the file that you want ...READ MORE

answered Jul 23, 2018 in Python by Omkar
• 67,620 points