.pyo's without .pyc's?

M.-A. Lemburg mal at lemburg.com
Wed May 26 17:49:34 EDT 1999


Randall Hopper wrote:
> 
> I'm trying to cook a minimalist Python install, and I find that python -O
> won't run without .pyc's in-place, even when there are pyo's.
> 
> I thought pyc's were the straight-compiled version, pyo's were the
> optimized version, and they were independent.  Is this correct?
> 
> To be specific:
> 
>      Python-1.5.2 > ff 'os.*'
>           ./lib/python1.5/os.pyo
>           ./lib/python1.5/os.pyc
> 
>      Python-1.5.2 > python
>           Python 1.5.2 (#2, May 26 1999, 12:25:54) [C] on irix646-n32
>           Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>           >>> ^D
> 
>      Python-1.5.2 > find . -name '*.pyc' | xargs rm
> 
>      Python-1.5.2 > python -O
>           'import exceptions' failed; use -v for traceback
>           Warning!  Falling back to string-based exceptions
> 
> Trying to run a python script with -O fails on other modules (os for example).

Looks like you have setup PYTHONPATH to point to some old
extensions.py file (the compiled versions seemed to be ok).

Try "python -vv" to have a look at the path scanning Python
does on startup.

Running Python with .pyo files only works just fine if you
remember to always use the -O flag on the command line.

For minimalist Python installs, you could also check out the
mxCGIPython project:

	http://starship.skyport.net/~lemburg/mxCGIPython.html

It's Python wrapped into a single file (with the standard
lib compiled with -O BTW).

-- 
Marc-Andre Lemburg
______________________________________________________________________
Y2000:                                                   219 days left
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/





More information about the Python-list mailing list