Message180121
>I think the next interesting question is to find out why an invalid home directory causes idle to not start up. There's no obvious reason why that should be the case in principle,
As Roger showed, IDLE will start up with an invalid home directory.
> so I suspect there's some error handling missing somewhere
Yes, the uncaught exception raised when attempting to display a non-essential but user-useful messages (this is the third issue I know of about this). There are 5 places in configHandler.py where a warning is directly printed to sys.stderr. There are two similar writes in PyShell.py. The first warning is the problem here, but any of them could be a problem and all should be handled better.
Lib/idlelib\PyShell.py: 1357: sys.stderr.write("Error: %s\n" % str(msg))
Lib/idlelib\PyShell.py: 1358: sys.stderr.write(usage_msg)
Lib/idlelib\configHandler.py: 209: sys.stderr.write(warn)
Lib/idlelib\configHandler.py: 223: sys.stderr.write(warn)
Lib/idlelib\configHandler.py: 255: sys.stderr.write(warning)
Lib/idlelib\configHandler.py: 367: sys.stderr.write(warning)
Lib/idlelib\configHandler.py: 624: sys.stderr.write(warning)
Why are warning used instead of message boxes? Perhaps easier, perhaps the latter are not available because the tk loop is not running. Possible solutions:
* Discard the message by just catching AttributeError (clikkeb) -- at each place indicated above. This would be better than nothing, but only as a temporary measure, and there is a better temporary measure below.
* Rearrange the start up process to make message boxes available, with default configuraton, before the configuration process.
* Make a list of messages and display them when it must (on exit, if that is possible with atexit) or in message boxes when it can.
* Solve the more general problem of writing to None by making sys.stdout and sys.stderr not be None, #13582. At minimum, even as a temporary measure, use something that just swallows output. Something like
import io
class DummyOut(io.IOBase):
def write(self, s):
return len(s)
dum = DummyOut()
print(dum.write('sixsix'))
# 6 |
|
Date |
User |
Action |
Args |
2013-01-17 08:35:48 | terry.reedy | set | recipients:
+ terry.reedy, roger.serwy, r.david.murray, asvetlov, clikkeb |
2013-01-17 08:35:48 | terry.reedy | set | messageid: <1358411748.61.0.85886088441.issue14576@psf.upfronthosting.co.za> |
2013-01-17 08:35:48 | terry.reedy | link | issue14576 messages |
2013-01-17 08:35:46 | terry.reedy | create | |
|