473,659 Members | 2,985 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(g lobals(),open('/tmp/dump0.txt','w') )
String 1
import pprint
pprint.pprint(g lobals(),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 990

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

Similar topics

13
2797
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 the sale of at least 10 Alex Martelli books. I am now in the fortunate position of being able to use Python for a large project, and as such I have a question. We are developing a distributed application running on approximately six thousand...
2
2334
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 produce the application) it has a import error: ---------- can't import SACD module (sacd.py) Error in sys.exitfunc:
0
1411
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 example, i want to use the 're' module. 2.build a exe(usedll.exe) which uses that dll. 3.use py2exe to eliminate the dependence of the python environment.
2
2763
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 the debug version built by me, both downloaded today to have the latest version).
5
3216
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 everything works fine. I also successfully embedded the Python interpreter into a plugin for a commercial 3D package (in this case Houdini - http://www.sidefx.com/ - using the HDK). I can use the interpreter to run Python commands and get values back...
3
3061
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
22503
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 particular? I'm thinking of running it on the Linksys's Linux-based open source router WRT54G. It has 4MB flash and 16MB RAM. I think another model has 16MB flash. Any possibilities of running Python on these systems?
5
3339
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 fragmentation in my system which is leading to out of memory after running few scripts. So I decided to re-initialise the python with out restarting the whole python. I tried to use Py_Finalise() after completion of each script , then call Py_Initialise as...
0
1189
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 exactly the *same* code? All those global statements are suspicious, and you don't even need most of them. Note that looking up a name in the global namespace is much slower than using a local name. Also, you're including the time it takes the OS...
4
2824
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. I want to be able to debug the Python script by using a debug server, like Winpdb (winpdb.org). I use ActivePython 2.5.2.2, Microsoft Visual Studio 2005, and Winpdb 1.3.8.
0
8428
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8747
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8528
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7356
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6179
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5649
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2752
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 we have to send another system
2
1976
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.