Re: .py source in interpreter exectuable?

Guido.van.Rossum@cwi.nl
Sat, 18 Jun 1994 10:51:04 +0200

Dan:
> If I were shipping a product consisting of a python interpreter, some
> custom C modules, and a bunch of .py source modules, I'd like to be
> able to bind them all in one big happy executable to save my users all
> the installation hassles involved with $PYTHONPATH and such.

Steve:
> Or better yet, save the compiled .pyc byte-code string.
> Printed from python, it should need little editing to
> turn into a C string literal - they both use the same
> \000 escape convention.

Check out Demo/scripts/filter.py -- it's all there, if a little rough.
It indeed saves the code objects in the same form (almost) as .pyc
files -- in fact the marshal module was extended with the facility to
write to strings in order to allow this kind of functionality...

--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
URL: <http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>