On Mar 26, 1:38 pm, John Machin <sjmac...@lexicon.net> wrote: > On Mar 26, 2:06 pm, Coonay <fla...@gmail.com> wrote: > > > see,the zipimort takes nearly 0.5 second > > > D 03-25 07:53PM 21.374 > > Loading __main__ > > I 03-25 07:53PM 21.455 > > zipimporter('/base/data/home/apps/coonay/1.332322118600950324/ > > django.zip', '') > > ?? zipimport.Zipimporter() has one arg, not two. > > > W 03-25 07:53PM 22.046 > > appengine_django module > > > On Mar 26, 10:41 am, Coonay <fla...@gmail.com> wrote: > > > > in my mudule ,i import another mudule from a zip , > > > > when i call my mudle method,the module in the zip will be import from > > > the zip every time,that slow down the operation, > > > > i try to search the some workarodnd or solution but i don't get one, > i don't use zipimport directly,just like u said i put the zip in the sys.path
> Why are you explicitly using the zipimport module? In other words, why > don't you put the full path of the zip file in sys.path and then just > use the normal "import module_in_the_zip" mechanism? Note that this i found the the module in the zip reloaded everytime the code is called,i mean, say ,first time it take me 1 second to call a method in the zip,but it take another 1 second to call the mothod for another time ,and so on > can/should be done once at the top of your calling module. In other > words, the import code is executed when the calling module is imported > by your main script, not every time you call a method in your calling > module. > In my developing environment ,there is a limitation of file number that i can deploy,such as i 'm only allowed to deploy 100 python files,so i have to zip some module > Alternatively, if you feel you *must* use zipimport, what's to stop > you doing that once at the top of the calling module? > > Note: it may help when you reply to show a stripped-down version of > your calling module, sufficient to back up your description of what is > happening. > > HTH, > John -- http://mail.python.org/mailman/listinfo/python-list