import and package confusion

Dale Amon amon at vnl.com
Thu Apr 30 02:19:55 CEST 2009


Well, I've managed to get close to what I want,
and just so you can see:

#!/usr/bin/python

import sys
sys.path.extend (['../lib', '../bin'])

from VLMLegacy.CardReader import CardReader
rdr = CardReader ("../example/B767.dat","PRINTABLE")

iotypes     = ["WINGTL","VLMPC","VLM4997"]
for iotype in iotypes:
        packagename = "VLMLegacy." + iotype + ".Conditions"
        classname   =  iotype + "_Conditions"
        code        = "from %s import Conditions as %s" \
			% (packagename, classname)
        x           = compile (code,"foo","exec")
        exec x
        cls = globals()[classname]
        a = cls(rdr,2)
        a.test()

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20090429/83d1057e/attachment.sig>


More information about the Python-list mailing list