Severe embedding problems - please HELP!!!

vm_usenet vm_usenet at yahoo.com
Mon Nov 25 16:27:08 EST 2002


Hi all,

I've posted several questions before about embedding Python - but I
have been encountering severe difficulties lately, as my project moved
on.

First, while attempting to run the known function PyRun_File - I
encountered an access violation in Windows. Further traces showed that
various file-handling functions crash unexpectedly - such as ftell and
the likes. When I tried calling the same functions from my code over
the same FILE*, nothing special happened. I recently saw another guy's
posting concerning the same problem, but it went unanswered. I guess
we're talking some kind of compilation issue here, perhaps a
compilation flag set/unset in the PCBuild?

Second, since none of the PyRun_*File* functions worked, I built a
wrapper around PyRun_String, for simulating running from a file. I
immediately understood that, amazingly, under that function,
carriage-return characters are not recognized by the parser!!!! Does
that sound reasonable to anyone? Is there a way to bypass this?

Third, when I finally stripped my file of \r's, The PyRun_String
function failed, making PyErr_Print claim that "__import__ not found".
What the hell? is there some sort of initialization required here
besides Py_Initialize? (my code imports some modules when it starts).
afterwards, I chopped several imports out of my code, and left it with
mere class declarations and several assignments. Then PyErr_Print told
me that __name__ was not found, although this token never even appears
in my code!!!!!!!!

Please, could someone explain what's going on??? I've seen the
interpreter do the exact same things in its own code!!! why isn't it
working?!? I'm simply going nuts, and I already spent three nights
over this.


I'd really appreciate any help,

vm



More information about the Python-list mailing list