1

Closed

PermissionError: [Errno 13]

description

Using PTVS 2.0, Python 64-bit 3.3 Interactive, I cannot simply open a file for editing. For example:
f = open('myfile.bin', 'wb') # Works without complaint in IDLE

throws PermissionError: [Errno 13] Permission denied in PTVS 2.0

Can someone explain? Much appreciated.
Closed Aug 5 at 12:21 AM by Zooba

comments

Zooba wrote May 19 at 6:11 AM

I'd check the current directory of each:
import os
os.getcwd()
In 2.0 I'd guess we're starting you in Program Files or System32, neither of which will let you create a file as a non-admin user. Idle is probably in the Python install directory, which will (but probably shouldn't).

You can use os.chdir to change the current directory, or specify the full name of the file. For PTVS 2.1 we will normally start the interactive window in a more sensible location based on your current project.

rogergosselin wrote May 20 at 3:51 AM

os.chdir('C:\Python33')
f = open('foo2', 'wb')
Works just fine, thank you!