classification
Title: IDLE fails to launch
Type: Stage:
Components: IDLE Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: kbk Nosy List: Carey, Piffen, Stephan.Bellegy, christian.heimes, kbk, loewis
Priority: normal Keywords:

Created on 2008-01-06 12:47 by richjtd, last changed 2010-09-23 13:46 by Stephan.Bellegy. This issue is now closed.

Messages (23)
msg59364 - (view) Author: Rich (richjtd) Date: 2008-01-06 12:47
Launching IDLE from the start menu has no effect, no windows open.
Command line Python still works. Reinstalling Python does not fix the 
problem.
I haven't changed my system configuration since everything was working.
Any ideas for things to check to fix this on my system would be much 
appreciated!
msg59369 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2008-01-06 13:40
What's your OS and how did you install Python on your machine?
msg59381 - (view) Author: Rich (richjtd) Date: 2008-01-06 15:14
I'm on 32-bit Windows Vista, and I installed with the Python 2.5 msi.
msg59402 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-01-06 18:43
Please open IDLE from the command line:
1. start cmd.exe
2. run "<path to python.exe>" "<path to python>/Lib/idle/idle.py"

That should give you an error, please report it.
msg59507 - (view) Author: Joakim (Piffen) Date: 2008-01-07 23:59
I have the exact same problem also running 32-bit vista. 
Idle worked the first time I started it but after that it doesn't start.
I did run the command and got this error.

C:\Users\Joakim>"C:\Python25\python.exe" "C:\Python25\Lib\idle.py"
C:\Python25\python.exe: can't open file 'C:\Python25\Lib\idle.py': 
[Errno 2] No such file or directory

I also not able to start the interpreter from cmd using the python 
command. I've looked around a bit and read something about adding to 
PATH. Haven't tried that because the guide wasn't written for Vista.
msg59509 - (view) Author: Joakim (Piffen) Date: 2008-01-08 00:16
Noticed I missed a bit of the path but it didn't matter.
Changed the path to C:\Python25\Lib\idlelib\idle.py and got another 
error.

C:\Users\Joakim>"C:\Python25\python.exe" "C:\Python25
\Lib\idlelib\idle.py"
Traceback (most recent call last):
  File "C:\Python25\Lib\idlelib\idle.py", line 21, in <module>
    idlelib.PyShell.main()
  File "C:\Python25\lib\idlelib\PyShell.py", line 1404, in main
    shell = flist.open_shell()
  File "C:\Python25\lib\idlelib\PyShell.py", line 275, in open_shell
    self.pyshell = PyShell(self)
  File "C:\Python25\lib\idlelib\PyShell.py", line 813, in __init__
    OutputWindow.__init__(self, flist, None, None)
  File "C:\Python25\lib\idlelib\OutputWindow.py", line 16, in __init__
    EditorWindow.__init__(self, *args)
  File "C:\Python25\lib\idlelib\EditorWindow.py", line 248, in __init__
    self.update_recent_files_list()
  File "C:\Python25\lib\idlelib\EditorWindow.py", line 715, in 
update_recent_fil
es_list
    rf_file = open(self.recent_files_path, 'w')
IOError: [Errno 13] Permission 
denied: 'C:\\Users\\Joakim\\.idlerc\\recent-files
.lst'

There should be a edit button somewhere but I couldn't find it, so I 
had to post a new entry.
msg59510 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2008-01-08 00:23
Can you access the file C:\\Users\\Joakim\\.idlerc\\recent-files.lst
with the explorer? Do the directory and the file exist?
msg59511 - (view) Author: Joakim (Piffen) Date: 2008-01-08 00:26
I can access the file. I renamed the file and tried the command again.
Then I started IDLE and got a window. A new recent-files.lst was 
created. So I guess I solved the problem temporarily.
msg59513 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2008-01-08 00:50
It smells like a Vista issue.

But IDLE shouldn't crash w/o a notice if the recent list can't be opened.
msg59530 - (view) Author: Rich (richjtd) Date: 2008-01-08 11:52
I've been away for a couple of days, but can replicate everything 
Joakim has reported in my abscence. Deleting/renaming recent-files.lst 
allows me to launch IDLE (from cmd or Start Menu).
Oddly though, if I close IDLE, copy/paste the contents of the old 
recent-files into the new one, and then restart IDLE, it still works.
Another thing I noticed, after launching IDLE from the Command Prompt, 
is that I get this error (while IDLE is still running and I haven't 
done anything with it yet):
Traceback (most recent call last): File "[...]\idlelib\run.py", line 
82, in main exit()
File "[...]\idlelib\run.py", line 208, in exit del sys.exitfunc
AttributeError: exitfunc

Is that normal?
msg59554 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-01-08 19:04
Can anybody provide a complete, reproducible procedure for that bug
(rather than reproducible procedures to work around it)? Such a
procedure might have to start with installing Python.
msg59700 - (view) Author: Rich (richjtd) Date: 2008-01-11 10:23
I can't get it to do it again.  Unless someone else is still 
experiencing the problem, perhaps it was fixed (deliberately or 
otherwise) by this month's Vista hotfixes that came down automatically 
a couple of days ago.
Thanks for your help everyone.
msg59873 - (view) Author: Kurt B. Kaiser (kbk) * (Python committer) Date: 2008-01-13 23:27
1. Could you look at the properties of the .idlerc\recent-files.lst that you 
saved and compare them to the new file which worked?  In particular, what 
about access permissions?

2. I agree that IDLE should have a better error response if opening a user 
config file fails.
msg59902 - (view) Author: Rich (richjtd) Date: 2008-01-14 16:28
Aha! There is no difference in Permissions, but the working recent-
files file isn't "hidden" but the one generated originally by IDLE was.
If I make the one I made "hidden" then IDLE stops working again. 
The .idlerc folder has been hidden all along though - that doesn't 
affect it.
If anyone's changing the way IDLE writes these files, would it be worth 
me saying that aesthetically, I'm not a fan of it putting them in a 
hidden folder in my top level User folder. What about putting them down 
inside Users/AppData like other applications do? Just a thought.
msg59924 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-01-14 21:51
We should clearly separate issues. Changing the organization of files is
entirely independent from fixing the bug reported here, and the issues
must not at all be mixed.

I'm puzzled as to why making the file hidden should have any effect, but
at least that's something that we can try to reproduce.
msg61545 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-01-22 22:38
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.
msg61546 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-01-22 22:43
As a follow-up, it appears that Windows didn't allow truncating hidden
or system files since Windows 2000. If you change the flags on .idlerc
to hidden in (say) W2k3, IDLE will also fail to start - so it's not a
Vista issue.

The question is why the folder "sudenly" became hidden - Python has no
API to make it so.

In any case, the proper solution is to delete the file rather than
overwriting it, perhaps like so

def save_overwrite_open(fname):
  try:
    return open(fname,"w")
  except IOError:
    os.unlink(fname)
    return open(fname,"w")
msg61612 - (view) Author: Kurt B. Kaiser (kbk) * (Python committer) Date: 2008-01-23 22:20
Thanks for the fix.  r60225.
msg62377 - (view) Author: Kurt B. Kaiser (kbk) * (Python committer) Date: 2008-02-14 04:53
backported 2.5.2c1
msg94928 - (view) Author: Carey (Carey) Date: 2009-11-05 13:46
I also had the same problem in Windows 7 64 bit. I unhid the file and
everything works now
msg117175 - (view) Author: Stephan Bellegy (Stephan.Bellegy) Date: 2010-09-23 10:05
Reproduced today with Python 2.6.6 and 2.7 on Win7 32 bits.

Deleting .idlerc directory made it.

Doesn't look like fixed guys ! ;-)
msg117178 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2010-09-23 10:34
Please submit this as a new bug issue, preferably with precise instructions on how to reproduce it. Can you provide some clue how the file became hidden in the first place?
msg117185 - (view) Author: Stephan Bellegy (Stephan.Bellegy) Date: 2010-09-23 13:46
New bug reported here
http://bugs.python.org/issue9925
History
Date User Action Args
2010-09-23 13:46:52Stephan.Bellegysetmessages: + msg117185
2010-09-23 10:34:33loewissetmessages: + msg117178
2010-09-23 10:05:24Stephan.Bellegysetnosy: + Stephan.Bellegy

messages: + msg117175
versions: + Python 2.6, - Python 2.5, Python 3.1
2009-11-05 15:12:52richjtdsetnosy: - richjtd
2009-11-05 13:47:00Careysetnosy: + Carey

messages: + msg94928
versions: + Python 3.1
2008-02-14 04:53:45kbksetmessages: + msg62377
2008-01-23 22:20:54kbksetstatus: open -> closed
resolution: fixed
messages: + msg61612
2008-01-22 22:43:58loewissetmessages: + msg61546
2008-01-22 22:38:11loewissetmessages: + msg61545
2008-01-14 21:51:04loewissetmessages: + msg59924
2008-01-14 16:28:15richjtdsetmessages: + msg59902
2008-01-13 23:27:13kbksetpriority: low -> normal
messages: + msg59873
2008-01-11 10:23:40richjtdsetmessages: + msg59700
2008-01-08 19:04:33loewissetmessages: + msg59554
2008-01-08 11:52:38richjtdsetmessages: + msg59530
2008-01-08 00:50:10christian.heimessetpriority: low
assignee: kbk
messages: + msg59513
nosy: + kbk
2008-01-08 00:26:37Piffensetmessages: + msg59511
2008-01-08 00:23:02christian.heimessetmessages: + msg59510
2008-01-08 00:16:32Piffensetmessages: + msg59509
2008-01-07 23:59:26Piffensetnosy: + Piffen
messages: + msg59507
2008-01-06 18:43:57loewissetnosy: + loewis
messages: + msg59402
2008-01-06 15:14:26richjtdsetmessages: + msg59381
2008-01-06 13:40:17christian.heimessetnosy: + christian.heimes
messages: + msg59369
2008-01-06 12:47:41richjtdcreate