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, 2019 in Python by Dinesh
720 views

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, 2019 by Omkar
• 69,030 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, 2019 in Python by Nymeria
• 3,520 points
1,746 views
0 votes
1 answer

Regarding pyc file in Python

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

answered Feb 7, 2019 in Python by Yogi
554 views
0 votes
1 answer

how to check for exceptions in a file?

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

answered Mar 20, 2019 in Python by Mohammad
• 3,210 points
60 views
+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,870 points
9,835 views
+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, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,454 views
0 votes
0 answers
+4 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,800 points
1,085 views
0 votes
1 answer

formatting_info=true for xlsx file handling

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

answered Mar 19, 2019 in Python by Omkar
• 69,030 points
226 views
+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
• 69,030 points
82 views