[Mailman-Developers] Listing Lists Faster in 2.0?
bwarsaw@cnri.reston.va.us
bwarsaw@cnri.reston.va.us
Mon, 3 Apr 2000 23:32:49 -0400 (EDT)
>>>>> "DM" == Dan Mick <Dan.Mick@West.Sun.COM> writes:
DM> But even when withlist is run from Python, PYTHONPATH/sys.path
DM> doesn't include /home/mailman/Mailman (this is 1.1):
| python -i bin/withlist <listname>
| Loading list: <listname> (unlocked)
>> sys.path
DM> ['/home/mailman', 'bin', '/usr/local/lib/python1.5/',
DM> '/usr/local/lib/python1.5/plat-sunos5',
DM> '/usr/local/lib/python1.5/lib-tk',
DM> '/usr/local/lib/python1.5/lib-dynload']
DM> This means that the relatively-obvious "import mm_cfg" doesn't
DM> work. How come? Things like that *do* seem like the very
DM> purpose of withlist.
Ah ha, now I understand your problem! Python's packaging system is
involved here too. All the non-top level entry point modules are
supposed to live under the `Mailman' package. In order to be able to
import from the Mailman package, you must have it's parent directory
on sys.path. Thus /home/mailman is on sys.path, and you can then
import Mailman.mm_cfg (or "from Mailman import mm_cfg"). You've gotta
specify the `Mailman' package some place though.
You'll notice that 2.0's withlist says
from Mailman.MailList import MailList
this imports the MailList class from the MailList module inside the
Mailman package.
Hope that helps,
-Barry