Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > can python import class or module directly from a zip package

Reply
Thread Tools

can python import class or module directly from a zip package

 
 
Flank
Guest
Posts: n/a
 
      03-10-2009
can python import class or module directly from a zip package ,just
like jave does from jar package without extracting the class file into
directory

so far as i know ,python module should be unzip to file system in
order to use them,
 
Reply With Quote
 
 
 
 
Stefan Behnel
Guest
Posts: n/a
 
      03-10-2009
Flank wrote:
> can python import class or module directly from a zip package


Yes, just put the .zip file into your PYTHONPATH.

Stefan
 
Reply With Quote
 
 
 
 
Seairth Jacobs
Guest
Posts: n/a
 
      03-10-2009
Flank wrote:
> can python import class or module directly from a zip package ,just
> like jave does from jar package without extracting the class file into
> directory
>
> so far as i know ,python module should be unzip to file system in
> order to use them,
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>

See http://peak.telecommunity.com/DevCenter/PythonEggs.

 
Reply With Quote
 
Lorenzo
Guest
Posts: n/a
 
      03-11-2009
On Mar 10, 2:13*pm, Flank <(E-Mail Removed)> wrote:
> can python import class or *module directly from *a zip package ,just
> like jave does from jar package without extracting the class file into
> directory
>
> so far as i know ,python module should be unzip to file system in
> order to use them,


After a little digging/googling, the answer came right from the docs:

http://docs.python.org/library/zipimport.html

I think that this module is just right what you need.

Cheers!
 
Reply With Quote
 
Gabriel Genellina
Guest
Posts: n/a
 
      03-11-2009
En Wed, 11 Mar 2009 11:47:54 -0200, Lorenzo <(E-Mail Removed)> escribió:
> On Mar 10, 2:13*pm, Flank <(E-Mail Removed)> wrote:


>> can python import class or *module directly from *a zip package ,just
>> like jave does from jar package without extracting the class file into
>> directory
>>
>> so far as i know ,python module should be unzip to file system in
>> order to use them,

>
> After a little digging/googling, the answer came right from the docs:
>
> http://docs.python.org/library/zipimport.html
>
> I think that this module is just right what you need.


Note that you don't have to do anything special to use zipimport; it's
enabled by default.
Just make sure your zip file name is present in sys.path, as if it were a
directory.

--
Gabriel Genellina

 
Reply With Quote
 
Coonay
Guest
Posts: n/a
 
      03-12-2009
On Mar 11, 9:47*pm, Lorenzo <(E-Mail Removed)> wrote:
> On Mar 10, 2:13*pm, Flank <(E-Mail Removed)> wrote:
>
> > can python import class or *module directly from *a zip package ,just
> > like jave does from jar package without extracting the class file into
> > directory

>
> > so far as i know ,python module should be unzip to file system in
> > order to use them,

>
> After a little digging/googling, the answer came right from the docs:
>
> http://docs.python.org/library/zipimport.html
>
> I think that this module is just right what you need.
>
> Cheers!


thanks you 2 guys
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
imp.find_module don't found my module but standard import statement can import this module… why ? Stéphane Klein Python 0 07-05-2011 07:36 AM
Possibility to add a zip-file to a new zip-file with "add to zip" (right-click) ?? erikkie@casema.nl Computer Support 4 06-26-2006 12:18 AM
The difference between "import package.module" and "from packageimport module"(about pymol) Xiao Jianfeng Python 2 12-16-2005 08:20 AM
Handling import conflicts when module has the same name as a library module that it needs to import? plb Python 0 02-08-2005 01:01 PM
package module import name clash with global package George P Python 3 09-11-2004 01:19 PM



Advertisments