Issue 1862: Error on "Save As" in IDLE (Vista 32-bit) (original) (raw)
Issue 1743 might be related to this.
Using "Save As..." in IDLE does work, but if breakpoints.lst is hidden (which it is when Python generates it) it also generates this error in the Shell:
Exception in Tkinter callback Traceback (most recent call last): File "C:\Program Files\Python25\lib\lib-tk\Tkinter.py", line 1403, in call return self.func(*args) File "C:\Program Files\Python25\lib\idlelib\IOBinding.py", line 357, in save_as self.editwin.store_file_breaks() File "C:\Program Files\Python25\lib\idlelib\PyShell.py", line 209, in store_file_breaks new_file = open(self.breakpointPath,"w") IOError: [Errno 13] Permission denied: 'C:\Users\Rich\.idlerc\breakpoints.lst'
The error is not generated if I manually unhide the breakpoints file. The issue is unaffected by the hidden (or not) status of the .idlerc folder.
I've studied the problem with Process Monitor. If a file is hidden, open(f, "w") fails, whereas os.open(f, os.W_OK|os.O_CREAT) succeeds.
In the succeeding call, process monitor reports
Desired Access: Generic Read/Write Disposition: OpenIf Options: Synchronous IO Non-Alert, Non-Directory File Attributes: N ShareMode: Read, Write AllocationSize: 0 OpenResult: Opened
In the failing call, it reports
Desired Access: Generic Write, Read Attributes Disposition: OverwriteIf Options: Synchronous IO Non-Alert, Non-Directory File Attributes: N ShareMode: Read, Write AllocationSize: 0
I then tried os.open(f, os.W_OK|os.CREAT|os.O_TRUNC) which also fails, giving
Desired Access: Generic Read/Write Disposition: OverwriteIf Options: Synchronous IO Non-Alert, Non-Directory File Attributes: N ShareMode: Read, Write AllocationSize: 0
So it fails for FILE_OVERWRITE_IF, but succeeds for FILE_OPEN_IF. These map back to CREATE_ALWAYS and OPEN_ALWAYS - apparently, you can't truncate a hidden file on Vista.