[medusa] Re: trouble with 19990902 snapshot: asyncore.loop() exists immediately (original) (raw)

Sam Rushing rushing@n...
Thu, 2 Sep 1999 21:51:43 -0700 (PDT)


jam writes:

I have been plugging away a little more at this problem, and when I change the 'from medusa import ...' line to include 'asyncore', and remove it from the top of the script, everything works fine. this is odd because I copied the 'asyncore.py' file from the distribution into /usr/lib/python1.5, so there really shouldn't be a problem, should there?

Ok, I figured it out... the package system is letting you introduce two different versions of the 'asyncore' module. The one used for 'asyncore.loop()' is not the one that knows about listening sockets.

Change the code thus:

hs.installhandler(dh) print asyncore, id(asyncore) print httpserver.asyncore, id(httpserver.asyncore) asyncore.loop()

And you get this:

| rushing@s...:/usr/src/nm/apps$ python strange.py | info: adding channel <cachingresolver at 814adf0> | info: adding channel <httpserver at 8149b18> | info: Medusa (V3.35) started at Thu Sep 2 21:48:29 1999 | Hostname: seattle | Port:8081 || <module 'asyncore' from '/usr/local/lib/python1.5/asyncore.py'> 135185384 | <module 'medusa.asyncore' from 'medusa/asyncore.pyc'> 135223912

sneaky, but not really the package system's fault: the whole idea of a package system is that you shouldn't have to worry about name collisions between unrelated packages.

-Sam