Re: importing pyc from memory?

2005-07-04 Thread Derek van Vliet
I do have to do everything you describe here in the current implementation of my system. I realize that importing a pyc file and compiling a string results in two different things. This is okay though as I'm fairly sure this will still suit my needs. As I said, the file format I plan to store thes

Re: importing pyc from memory?

2005-07-04 Thread Derek van Vliet
The second method you describe sounds like it is along the lines of what I need to do. Is there a way to do this using the Python/C API? For instance, if I have the contents of a pyc file loaded entirely into memory, and I have a pointer to the beginning of the file and the size in bytes at my dis

Re: importing pyc from memory?

2005-07-04 Thread Derek van Vliet
Up to now, I've had all my python scripts defined in XML elements, which were compiled when my program started up using Py_CompileString. This has worked great, but I'm finding that most of the time my app uses to start up is spent in that Py_CompileString, because of the large number of scripts th

importing pyc from memory?

2005-07-04 Thread Derek van Vliet
Using the Python/C API, is there a way I can import a pyc file that I have in memory (as opposed to loading from disk)? I'm trying to save compiled python code in a proprietary file format to cut reduce the overhead of compiling all my scripts when my app starts up. Derek -- http://mail.python.

Re: saving pre-compiled scripts

2005-06-30 Thread Derek van Vliet
I probably should have also mentioned that my application is written in C++ and using the Python/C API. -- http://mail.python.org/mailman/listinfo/python-list

Re: saving pre-compiled scripts

2005-06-30 Thread Derek van Vliet
Another thing which may be important to note re: my constraints is that each script is essentially being run as a function. In fact, every script element I parse in XML gets wrapped in a function def before I send it to Py_CompileString. I then PyEval the result of that function, and then run Py_

saving pre-compiled scripts

2005-06-30 Thread Derek van Vliet
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 scri