473,408 Members | 1,729 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Difference between Py_NewInterpreter() and Py_Initialize()

Bulldog
I am working on a C++ win32 DLL which has calls to python, mainly import some modules, call some functions and return some values. Right now I am using the Py_Initialize() and Py_Uninitialize() functions to get to the embedded interpreter. I am having an issue with making repeated calls to the function(s) that my DLL exports, namely I get an error trying to import a python module that I imported the previous time I placed a call to that DLL.

What I am seeing leads me to believe that there are some cleanup issues and I would like to get a better idea of what Py_Initialize does vs. what Py_NewInterpreter() does. Does Py_Initialize just create a new thread in the existing interpreter, in which do I need to acquire a lock before using that thread?

Any insight would be greatly appreciated. TIA
Jan 25 '07 #1
0 2116

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Paul Miller | last post by:
I have a C++ application that uses multiple embedded Python interpreters. I allocate multiple interpreters using Py_NewInterpreter, and switch between them using PyThreadSate_Swap. In 2.2.2,...
1
by: Wiktor Sadowski | last post by:
Thomas,consider this: specialized_python.exe --path/foo.px (command line) where foo.px is zipped ctypes-venster program -modules,some code,binaries(images etc.) specialized_python.exe could be...
0
by: Christoph Wiedemann | last post by:
Hello, i have some trouble to understand the Py_NewInterpreter API function. The docs state, that Py_NewInterpreter returns a new PyThreadState instance. One can switch between interpreters by...
0
by: Roman Suzi | last post by:
In pure curiosity I tried to compile loop.c from Demo/embed and started it with 'print 2+2'. It seems, that both 2.3 and 2.4 pythons have memory leaks in Py_Initialize/Py_Finalize calls. (That is,...
0
by: Andrew Trevorrow | last post by:
Hi folks, I've only been using Python for a few weeks, so please be gentle. :) Lovely language by the way -- I really enjoying using it -- but I've struck a very nasty problem when running...
0
by: magazine | last post by:
-----Original Message----- From: Steve Holden Sent: 2006Äê4ÔÂ4ÈÕ 20:00 To: DMagazine@163.com Cc: tim@pollenation.net Subject: Re: #286: Py_Initialize faliure if the python24.lib build with...
3
by: freesteel | last post by:
/* Is this a bug in Py_NewInterpreter? The function below "MyThread" is instantiated from a windows worker thread, but I don't think that is relevant. (I can try this on a linux box, but I...
0
by: eastier | last post by:
Hi all, I've an application with embedded python. In order to reload the python scripts, I end the python session, and reopen one just after : <...release used modules...> Py_Finalize();
62
by: robert | last post by:
I'd like to use multiple CPU cores for selected time consuming Python computations (incl. numpy/scipy) in a frictionless manner. Interprocess communication is tedious and out of question, so I...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
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
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...

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.