473,503 Members | 10,178 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
pprint.pprint(globals(),open('/tmp/dump0.txt','w'))
String 1
import pprint
pprint.pprint(globals(),open('/tmp/dump1.txt','w'))
F('namesonly')
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
exists.

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 983

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
2773
by: Alexander May | last post by:
Hi, I love Python! I've been using it for a couple of years now and have found it to be a highly productive language. I evangelize it to my developer friends and am probably responsible for...
2
2317
by: Miki Tebeka | last post by:
Hello All, I have a funny problem: An embedded python application is working fine on a "clean" computer. When it runs on a computer with python installed (the very same computer used to...
0
1398
by: newbie | last post by:
Hi all, I got a problem using the embedded python. I'll be appreciated if some one can show me the way. What i want is, 1.build a dll(test.dll/test.lib) which uses the embedded python, for...
2
2748
by: Ugo Di Girolamo | last post by:
I have the following code, that seems to make sense to me. However, it crashes about 1/3 of the times. My platform is Python 2.4.1 on WXP (I tried the release version from the msi and...
5
3202
by: wahn | last post by:
Hi, Here is a problem I came across and need some help with. I developed a little Python script with some classes which runs standalone and communicates with a database via sockets. So far...
3
3046
by: Godzilla | last post by:
Has anyone install Python on Windows XP Embedded? We wish to evaluate the possible solution of installing Python with WinXPE on a PC/104 plus module. Thank you.
20
22469
by: Jack | last post by:
Is there a Python packaging that is specifically for embedded systems? ie, very small and configurable so the user gets to select what modules to install? For Linux-based embedded systems in...
5
3334
by: vishnu | last post by:
Hi there, I am embedding python 2.5 on embedded system running on RTOS where I had strict memory constraints. As python is a huge malloc intensive application, I observed huge memory...
0
1173
by: Gabriel Genellina | last post by:
En Tue, 03 Jun 2008 16:58:12 -0300, Pau Freixes <pfreixes@milnou.net> escribió: So the above code corresponds to the standalone version - what about the embedded version? Are you sure it is...
4
2813
by: Chris8Boyd | last post by:
I am embedding Python in a MSVC++ (2005) application. The application creates some environment and then launches a Python script that will call some functions exported from the MSVC++ application....
0
7207
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
7015
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5602
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5026
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4693
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3183
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1523
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
749
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.