A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-December/041401.html below:

[Python-Dev] Importing packages from command line

[Python-Dev] Importing packages from command line [Python-Dev] Importing packages from command lineDmitry Vasiliev lists at hlabs.spb.ru
Tue Dec 23 06:05:37 EST 2003
Nick Coghlan wrote:
> Dmitry Vasiliev 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...
> 
>   python runzip.py mypkg.zip
> 
> where runzip.py is a pure Python script that works as you suggest.
> 
> I'm fairly sure zipimport would allow you to write the program you 
> describe in pure Python. I've obviously never written such a program, 
> though.

Code is fairly simple.

import sys
sys.path.insert(0, "module.zip")
import module

> It's certainly an interesting packaging idea for small Python programs 
> with several files, but for which a full-blown installer would be overkill.

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


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4