saving pre-compiled scripts



Hi,

I'm working on an application that reads python scripts from XML
elements and compiles them during my app's startup process using. The
application then runs the resulting compiled PyCodeObjects using
PyEval_EvalCode as they are needed.

Now I'm wondering if its possible to pre-compile the scripts and save
the PyCodeObjects in a binary file (or in CDATA in an XML element) and
have them ready to run when the application starts up.

My only constraint is that I need to be able to load the scripts from
memory (which is why using Py_CompileString has worked well for me).

Is there any way I can get the size of a PyCodeObject so that I could
save it to a binary file? If I did that would it run correctly if I
reloaded it and tried to Eval it? Can I load a pyc file from memory
somehow?

Any guidance would be greatly appreciated.

Thanks,
Derek

.



Relevant Pages

  • Re: Idea for FreeBSD
    ... I am A FreeBSD administrator as well as a Solaris Administrator. ... is take all the rc.d scripts and puts them into ... Everything is converted to XML ... better format, you need to start by showing that said format is better ...
    (freebsd-hackers)
  • Re: cgi and headers
    ... i'm starting to work with python cgi scripts using ajax. ... explorer thing doesn;t process the xml unless it gets back the xml header. ...
    (comp.lang.python)
  • Re: Sorting
    ... Here's how to load an XSLT stylesheet into an XslTransform object ... > I am not familiar with sorting using XSL. ... >>> I have an xml file as listed below. ... This is a list of scripts. ...
    (microsoft.public.dotnet.framework.clr)
  • Re: Sorting
    ... Here's how to load an XSLT stylesheet into an XslTransform object ... > I am not familiar with sorting using XSL. ... >>> I have an xml file as listed below. ... This is a list of scripts. ...
    (microsoft.public.dotnet.framework)
  • Re: Sorting
    ... Here's how to load an XSLT stylesheet into an XslTransform object ... > I am not familiar with sorting using XSL. ... >>> I have an xml file as listed below. ... This is a list of scripts. ...
    (microsoft.public.dotnet.general)