-->

Welcome to our Coding with python Page!!! hier you find various code with PHP, Python, AI, Cyber, etc ... Electricity, Energy, Nuclear Power

Monday, 1 June 2020

Python - IOError: [Errno 13] Permission denied

All about Agile, Ansible, DevOps, Docker, EXIN, Git, ICT, Jenkins, Kubernetes, Puppet, Selenium, Python, etc

IOError: [Errno 13] Permission denied 


Solution:

It looks like you're trying to replace the extension with the following code:
if (myFile[-4:] == ".asm"):
    newFile = myFile[:4]+".hack"
However, you appear to have the array indexes mixed up. Try the following:
if (myFile[-4:] == ".asm"):
    newFile = myFile[:-4]+".hack"
Note the use of -4 instead of just 4 in the second line of code. This explains why your program is trying to create /Use.hack, which is the first four characters of your file name (/Use), with .hack appended to it.

No comments:

Post a Comment

Thanks for your comments

Rank

seo