[Python-Dev] Importing packages from command line

Dmitry Vasiliev lists at hlabs.spb.ru
Tue Dec 23 06:09:27 EST 2003


Alex Martelli wrote:
>>The main idea is to treating package as a program and run package
>>initialization code from command line. The advantage is zipping all
>>program modules in one zip archive and running the program from command
>>line without unzipping it, like Java's jar's. But this idea need more
>>thoughts however...
> 
> Couldn't you use:
>     python -c "import package_name"
> for this purpose even today?

python -c "import sys; sys.path.insert(0, 'module.zip'); import module"

Seems ugly... :)

-- 
Dmitry Vasiliev (dima at hlabs.spb.ru)




More information about the Python-Dev mailing list