[issue14576] IDLE cannot connect to subprocess - New solution

2012-04-14 Thread clikkeb

New submission from clikkeb :

It's a common issue that IDLE cannot start on Windows because

"IDLE's subprocess didn't make connection.Either IDLE can't start a subprocess 
or personal firewall software is blocking the connection."

Everyone claim that the user should set the firewal so that IDLE can connect to 
subprocess via loopback. I found, instead, that this issue is often caused by 
an incorrect or missing setting of one the following variables: HOME, 
USERPROFILE or the combination of HOMEPATH and HOMEDRIVE; if these variables 
don't represent an existent and writable directory, the error occurs.
Try setting HOMEPATH to an unexistent  or unwritable directory just before 
launching idle.bat script.
Check IdleConf.GetUserCfgDir() in module configHandler.py, where the function 
os.path.expanduser is called to get the user home directory. You might also 
temporarly patch GetUserCfgDir, setting the userDir variable to an unexistent 
path just after it has been initialized via os.path.expanduser (line 202).
Should be considered a check on expanduser behaviour?

OS: Windows XP
Python version: 3.2.2

clikkeb

--
components: IDLE
messages: 158253
nosy: clikkeb
priority: normal
severity: normal
status: open
title: IDLE cannot connect to subprocess - New solution
versions: Python 3.2

___
Python tracker 
<http://bugs.python.org/issue14576>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14576] IDLE cannot connect to subprocess - New solution

2012-04-15 Thread clikkeb

clikkeb  added the comment:

Thanks for your answer.

Trying to understand how IDLE uses HOMEPATH and USERPROFILE Windows
variables, I have found the following information:
1) it seems that when executed via Windows command prompt (cmd.exe),
   os.path.expanduser refers to USERPROFILE to determine the user's
   home directory;
2) analizing the stack traces of the first calls to
   IdleConf.GetUserCfgDir, you can see that GetUserCfgDir (which
   calls expanduser) is called three times during IDLE startup:
   the first two times it refers to USERPROFILE, the third (called
   via run.py, probably after starting a subprocess) it refers to
   the combination of HOMEDRIVE and HOMEPATH. (???)
3) when you start IDLE using pythonw, sys.stderr.write(warn) seems
   to raise an AttributeError exception, which is unhandled. This
   causes IDLE to stop running when you either start IDLE that way
   and the user's home directory is unreachable.

Due to the Python's tricky behaviour in determining the Windows
user's home directory, my opinion would be to consider if it is
worth to go further with this discussion or if it could produce
a benefit to IDLE. For sure, it gave me a little bit of headache.

clikkeb.

--

___
Python tracker 
<http://bugs.python.org/issue14576>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14576] IDLE cannot connect to subprocess - New solution

2012-04-16 Thread clikkeb

clikkeb  added the comment:

I think that lines 207-210 of GetUserCfgDir should be modified like this:

try:
sys.stderr.write(warn)
except (IOError, AttributeError):# < 
pass#^^

because when you start IDLE via pythonw.exe (that sets sys.stderr to "None"),
the function call sys.stderr.write(warn) raises the following exception:

AttributeError: 'NoneType' object has no attribute 'write'

and IDLE stops running without displaying any exception error, because that
exception is unhandled.

There is a funcion call to sys.stderr.write also at line 222, just before a
"raise SystemExit" statement, which makes ininfluent the missing 
AttributeError exception handling.

--

___
Python tracker 
<http://bugs.python.org/issue14576>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14576] IDLE cannot connect to subprocess - New solution

2012-04-17 Thread clikkeb

clikkeb  added the comment:

It is one of the possible solutions.

In combination with the "writable flag" solution, you might create a class
variable in IdleConf (e.g. "user_cfg") that contains the user's home directory;
such variable will be initialized to an empty string by IdleConf.__init__.
On each call, GetUserCfgDir tries to initialize "user_cfg" only if it is an
empty string, otherwise it returns it's content.

Anyway, keep in mind that in GetUserConfig there's an unhandled exception 
(AttributeError) that might be the cause of the "IDLE doesn't start..." issue 
reported by users.

--

___
Python tracker 
<http://bugs.python.org/issue14576>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com