0

When I run my script from Idle my program runs perfectly, but when I run the .py file and it spawns a shell @ C:\Python27\Python.exe my program fails with the following error:-

IOError: [Errno 13] Permission denied: 'my new file.html'

And the bit of code is:-

f = open("my new file.html", "w")

I have searched for this IOError but the things people are saying don't appear to tie in with what I am doing, which is writing out a file?

1 Answer 1

1

If it says "permission denied", that's telling you that you don't have permission to create that file. It isn't lying to you. The first rule of debugging is to always assume the error is telling you the literal truth.

Since you didn't supply a folder in the filename, it's trying to create a file in the current directory. You are probably in a protected folder. If you cd to a folder where you have write permissions, the problem will likely go away.

Sign up to request clarification or add additional context in comments.

1 Comment

Yeah, thats the issue sorry for being such a noob. I now have a new issue in that its spawning IE instead of my default browser and searching for my new file instead of opening it but I will try and figure that out. - That issue is now fixed as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.