Odd behavior with imp.reload and logging

Andrew Berg bahamutzero8825 at gmail.com
Thu Sep 22 01:54:10 EDT 2011

On 2011.09.22 12:09 AM, Chris Angelico wrote:
> On-the-fly reloading of modules isn't really one of Python's
> strengths. Everyone who asks about it seems to be doing rapid
> development/debugging and wanting to save on startup time (as opposed
> to, say, running a server and updating code in it while it's active
> and serving clients), so the question becomes: Which is more of a
> problem, startup delay or the risk that it's not the same as a clean
> start? Python doesn't guarantee that your debugging session is going
> to be useful - if you reload that module and weird things happen, it
> could be because of reload(), not because of a module bug.
The main program is an IRC bot, which could potentially be in use by
many people in several channels on a network. As it is, the bot can only
connect to one server, but it could probably be set up to connect to any
number of networks. Making a number of quick fixes or changes to one
module could be very irritating to users if the bot has to terminate
each time, especially if those users don't know or care about that
specific module.
Startup time is an issue because it must connect to a network before it
can take any input. Also, many disconnects/reconnects could easily cause
problems (like the network refusing the connection as a DoS prevention
I'm not tied to any particular solution, and it's quite possible I'm
missing something since I am still a beginner.

CPython 3.2.2 | Windows NT 6.1.7601.17640 | Thunderbird 6.0.2

More information about the Python-list mailing list