You didn't show us what's in the zip file. Can you show a zipinfo output? My intention with import was always that without -O, *.pyo files are entirely ignored; and with -O, *.pyc files are entirely ignored.
It sounds like you're saying that you want to change this so that .pyc and .pyo are always honored (with .pyc preferred if -O is not present and .pyo preferred if -O is present). I'm not sure that I like that better. If that's how zipimport works, I think it's broken! --Guido On 11/8/05, Osvaldo Santana Neto <[EMAIL PROTECTED]> wrote: > Hi, > > I'm working on Python[1] port for Maemo Platform[2] and I've found a > inconsistent behavior in zipimport and import hook with '.pyc' and > '.pyo' files. The shell section below show this problem using a > 'module_c.pyc', 'module_o.pyo' and 'modules.zip' (with module_c and > module_o inside): > > $ ls > module_c.pyc module_o.pyo modules.zip > > $ python > >>> import module_c > >>> import module_o > ImportError: No module named module_o > > $ python -O > >>> import module_c > ImportError: No module named module_c > >>> import module_o > > $ rm *.pyc *.pyo > $ PYTHONPATH=modules.zip python > >>> import module_c > module_c > >>> import module_o > module_o > > $ PYTHONPATH=modules.zip python -O > >>> import module_c > module_c > >>> import module_o > module_o > > I've create a patch suggestion to remove this inconsistency[3] (*I* think > zipimport behaviour is better). > > [1] http://pymaemo.sf.net/ > [2] http://www.maemo.org/ > [3] http://python.org/sf/1346572 > > -- > Osvaldo Santana Neto (aCiDBaSe) > icq, url = (11287184, "http://www.pythonbrasil.com.br") > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/guido%40python.org > -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com