473,468 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

(EMBEDDING) Can't get python error message

I run this string to produce a error "x+1"

PyRun_SimpleStringFlags() return -1, so that i know this is a script
with error inside...

but now - how can i get error message?

i tested some py-functions - but this functions do not work... i
called this functions direct after PyRun_SimpleStringFlags

PyErr_Occurred() return always 0
PyErr_Fetch() with 3 pointers... all values are always Null
PyErr_Print() do nothing

strange...

but after my programm end... here comes a error message (from StdErr i
think)

Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'x' is not defined

Jul 5 '07 #1
1 1861
En Thu, 05 Jul 2007 08:47:57 -0300, <an************@mymail.chescribió:
I run this string to produce a error "x+1"

PyRun_SimpleStringFlags() return -1, so that i know this is a script
with error inside...

but now - how can i get error message?
Simply, you can't. From http://docs.python.org/api/veryhigh.html: "If
there was an error, there is no way to get the exception information."
Use another function instead, like PyRun_StringFlags()

--
Gabriel Genellina

Jul 6 '07 #2

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

Similar topics

0
by: Atul Kshirsagar | last post by:
I am embedding python in my C++ application. I am using Python *2.3.2* with a C++ extention DLL in multi-threaded environment. I am using SWIG-1.3.19 to generate C++ to Python interface. Now to...
4
by: Alicia Haumann | last post by:
I accidentally sent this to webmaster@python.org, so this could be a duplicate if "webmaster" forwards it to this list. :{ Hi, there. Thanks for any help that can be offered. I've been...
1
by: Craig Ringer | last post by:
Hi folks I'm a bit of a newbie here, though I've tried to appropriately research this issue before posting. I've found a lot of questions, a few answers that don't really answer quite what I'm...
3
by: brobigi | last post by:
well I manage to figure it out myself. I'm using Bloodshed Dev-cpp Here's the code: #include "python.h" #include <stdio.h> int main(int argc, char* argv) { double answer = 0;
0
by: zhang xiaoning | last post by:
Hi, I download and extract python-2.4.2 source code for unix, and then, build and install it on aix5, the configure option I used is: ../configure --enable-shared --disable-ipv6...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
1
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
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,...
1
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...
0
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 ...

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.