(EMBEDDING) Can't get python error message

Discussion in 'Python' started by anonymisiert85@mymail.ch, Jul 5, 2007.

  1. Guest

    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, 2007
    #1
    1. Advertising

  2. En Thu, 05 Jul 2007 08:47:57 -0300, <> escribió:

    > 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
     
    Gabriel Genellina, Jul 6, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tshad
    Replies:
    0
    Views:
    826
    tshad
    Jan 27, 2005
  2. rabbits77
    Replies:
    0
    Views:
    901
    rabbits77
    Feb 26, 2004
  3. Donnie Leen
    Replies:
    2
    Views:
    288
    Donnie Leen
    Dec 7, 2004
  4. Johannes Zellner
    Replies:
    1
    Views:
    512
    Alex Martelli
    Jan 17, 2006
  5. Mathieu CLERICI

    Embedding python : can't find encoding error

    Mathieu CLERICI, Feb 28, 2011, in forum: Python
    Replies:
    2
    Views:
    1,172
    swapnil
    Mar 1, 2011
Loading...

Share This Page