import and package confusion

Dale Amon amon at
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:


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)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: Digital signature
URL: <>

More information about the Python-list mailing list