Join Python script into a huge one

Chris Liechti cliechti at gmx.net
Thu May 9 20:46:47 EDT 2002


"Ugo García" <plugin at supercable.es> wrote in
news:1020981481.93253 at seux119: 

> hi all. I use python as the script language of a game I'm doing in
> Visual C. The problem that I have is that the game could have very
> much scripts and I don't want the user to "see" those. I know that I
> can compile them and don't include the source but I still having the
> problem of the number of files. Is there any way to join ALL scripts
> into a huge one???? It could be great to have all the scripts in only
> one file. 

if you wan't to keep the number of files but not make them visible, 
consider packing them up in a ZIP file and then use the zipfile module and 
a custom import hook.
variants of this technique are used in py2exe and Installer.
this could also help:http://www.mcmillan-inc.com/iu.html

other possibilities could be packing them in string resources and feed them 
throug PyRun_SimpleString or use freeze to convert them to char arrays of 
bytecode. but i'm in favor of keeping them in a zip as this is the easiest 
to change/upgrade when you change one of your scripts.

chris

-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list