py2exe and dynamic modules
Peter Hansen
peter at engcorp.com
Mon Jun 9 16:54:23 EDT 2003
"Uwe C. Schroeder" wrote:
>
> Peter Hansen wrote:
>
> > Run imptest.exe from a directory other than c:/temp:
> >
> > "test OK" results.
> >
> > Looks like it works... (I'm doing this test first... what did I do
> > wrong this time? :-)
>
> :-)) You knew the path up front. But I'll probably do just that and install
> the modules in a fixed path, although I don't really like it. But I guess
> it's easier than fiddling around with the py2exe import stuff.
Don't make it so hard on yourself! Here's version two, without a
hardcoded path:
import sys
sys.path.append(sys.argv[1])
filename = sys.argv[2]
try:
mod = __import__(filename)
print mod.test()
except:
print 'test failed!'
Still works... ;-)
-Peter
More information about the Python-list
mailing list