472,139 Members | 1,555 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,139 software developers and data experts.

Embedded python problem

We have a client using a fully embedded python in a large DTP app. It used to be
Mac OS 9/X only, but the MAC 9 support has gone away and we now have support for
the PC with the embedding being used in C# via external DLL aliasing/marshalling
etc etc.

The embedding DLL has effectively a single entry point called _run_string; this
takes an LPStr string and with minor wrapping (to collect sys.stderr) is passed
to an exec statement doing

exec code in __main__.__dict__

The client is having problems with a pair of executions looking effectively like

String 0
class C:
def F(a):
... C()....
import pprint
String 1
import pprint
The import pprint stuff is used to attempt to resolve the problem of F having
vanished in the second environment.

From the outputs dump0.txt/dump1.txt I can see that both C and F are defined at
the end of 0, but at the beginning of 1 C still exists (and appears to have the
same address), but F is nowhere to be seen. I'm guessing that someone is
cleaning up somewhere, but could this be some .Net threading issue?

When I run this with a simple C# test harness it does exactly as expected and F

I have suggested wrapping the function as a class instance with a __del__ method
having a stack dump to see if the function is deleted deliberately somehow,
but that won't work if in fact the second environment is in fact not the same as
the other. Is there some way to work out if I'm in the same interpreter if in
fact we're joining the DLL in two places perhaps?
Robin Becker

Jul 3 '06 #1
0 923

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Alexander May | last post: by
reply views Thread by newbie | last post: by
2 posts views Thread by Ugo Di Girolamo | last post: by
5 posts views Thread by wahn | last post: by
3 posts views Thread by Godzilla | last post: by
20 posts views Thread by Jack | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.