Author terry.reedy
Recipients asvetlov, clikkeb, r.david.murray, roger.serwy, terry.reedy
Date 2013-01-17.08:35:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
>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 where a warning is directly printed to sys.stderr. There are two similar writes in The first warning is the problem here, but any of them could be a problem and all should be handled better.

Lib/idlelib\ 1357: sys.stderr.write("Error: %s\n" % str(msg))
Lib/idlelib\ 1358: sys.stderr.write(usage_msg)
Lib/idlelib\ 209:    sys.stderr.write(warn)
Lib/idlelib\ 223:    sys.stderr.write(warn)
Lib/idlelib\ 255:    sys.stderr.write(warning)
Lib/idlelib\ 367:    sys.stderr.write(warning)
Lib/idlelib\ 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()
# 6
Date User Action Args
2013-01-17 08:35:48terry.reedysetrecipients: + terry.reedy, roger.serwy, r.david.murray, asvetlov, clikkeb
2013-01-17 08:35:48terry.reedysetmessageid: <>
2013-01-17 08:35:48terry.reedylinkissue14576 messages
2013-01-17 08:35:46terry.reedycreate