68 lines
2.2 KiB
Plaintext
68 lines
2.2 KiB
Plaintext
From: thstr at serop.abb.se (Thomas S. Strinnhed)
|
|
Date: Thu, 20 May 1999 08:57:15 +0200
|
|
Subject: The Very High Layer and friends
|
|
References: <37304719.C258AEFB@serop.abb.se> <14129.52530.662084.712010@weyr.cnri.reston.va.us>
|
|
Message-ID: <3743B24B.4F694D86@serop.abb.se>
|
|
Content-Length: 1908
|
|
X-UID: 1894
|
|
|
|
Hi
|
|
|
|
I just might do as you say and ask again, beeing more specific.
|
|
(I've downloaded the new manuals, but I still can't figure it out.)
|
|
|
|
The thing is: I'v taken the Demo/Embed example from the distribution
|
|
(demo.c) and added calls to PyRun_SimpleFile() which causes the
|
|
application to crash (using NT) and saying that memory can't be read.
|
|
|
|
Here are the few lines i added to demo.c
|
|
|
|
FILE *fp = NULL; /* First of all a FILE-pointer */
|
|
...
|
|
if(!(fp = fopen("test2.py", "r"))) /* Open file */
|
|
printf("\nError: can't open file test2.py\n");
|
|
...
|
|
PyRun_SimpleFile(fp, "test2.py"); /* B A N G */
|
|
...
|
|
|
|
Here is the file i want to execute, test2.py
|
|
print 'test2.py'
|
|
|
|
I must have missed something about the FILE-pointer. I've tried
|
|
different modes to open the file in r, rt, r+, a but the same problem
|
|
occurs. I've verified that the FILE-pointer is correct by reading it
|
|
with fgets() a couple of times and that works, I get the text from the
|
|
file.
|
|
|
|
So I *think* the questions should be:
|
|
* What kind of FILE-pointer does PyRun_SimpleFile() expect??
|
|
* If the FILE-pointer is OK, what causes the error??
|
|
|
|
Thanks
|
|
-- Thomas S. Strinnhed, thstr at serop.abb.se
|
|
|
|
Fred L. Drake wrote:
|
|
>
|
|
> Thomas S. Strinnhed writes:
|
|
> > (I have all the downloadable manuals; Embedding..., Library Reference,
|
|
> > Tutorial, Python/C API Reference, Python Reference.)
|
|
>
|
|
> Thomas,
|
|
> As Dave Kuhlman pointed out, a newer version of the manuals probably
|
|
> has enough information to answer your questions about the functions
|
|
> you're asking about.
|
|
> If the information isn't sufficient, please don't hesitate to ask
|
|
> again, explaining what you're looking for in more detail.
|
|
> The HTML distribution can be unpacked directly in your <Python
|
|
> installation dir>\Doc\ directory to update the installed manuals.
|
|
>
|
|
> -Fred
|
|
>
|
|
> --
|
|
> Fred L. Drake, Jr. <fdrake at acm.org>
|
|
> Corporation for National Research Initiatives
|
|
|
|
|
|
|
|
|