How to Parse a Script before execution

Discussion in 'Python' started by Susanne, Dec 8, 2003.

  1. Susanne

    Susanne Guest

    Hello,

    i need some help with python.
    I have written some c++ extensions for python, and i can execute a
    script, calling this functions. (PyRun_SimpleFile)

    Now my problem is, that i want to parse the script first, because i
    want
    to know, if there are any wrong arguments (e.g. not the right number
    of arguments, or of wrong type (int, char* etc.)).

    PyRun_SimpleFile tells me, whether there is an error, but
    it executes all calls before the wrong one.

    Can anyone give me a hint?

    PyParser_SimpleParseFile is not, what i am looking for!!

    Thanks a lot.
    Susanne
    Susanne, Dec 8, 2003
    #1
    1. Advertising

  2. Susanne

    Susanne Guest

    Hello,

    i was looking for a solution in the groups, and
    someone did it with:

    struct _node * myNode = PyParser_SimpleParseFile(...);
    PyNode_Compile(myNode);
    PyEval_EvalCode(...);

    I am using Python 2.3 and there my Visual Compiler says, that there
    is no PyNode_Compile().

    I also looked i different books, and in the html-help of
    Python 2.3, but found nothing usable.

    Perhaps anyone of you has an idea, how to solve my problem.

    Thanks
    Susanne
    Susanne, Dec 10, 2003
    #2
    1. Advertising

  3. Susanne

    Susanne Guest

    Hello,

    i was looking for a solution in the groups, and
    someone did it with:

    struct _node * myNode = PyParser_SimpleParseFile(...);
    PyNode_Compile(myNode);
    PyEval_EvalCode(...);

    I am using Python 2.3 and there my Visual Compiler says, that there
    is no PyNode_Compile().

    I also looked into different books, and in the html-help of
    Python 2.3, but found nothing usable.

    Perhaps anyone of you has an idea, how to solve my problem.

    Thanks
    Susanne
    Susanne, Dec 10, 2003
    #3
    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. =?Utf-8?B?Sm9zZVZhbGVuY2lh?=

    How to avoid execution of page_load event before click event of a

    =?Utf-8?B?Sm9zZVZhbGVuY2lh?=, Apr 3, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    609
    =?Utf-8?B?Sm9zZVZhbGVuY2lh?=
    Apr 4, 2006
  2. Manuel
    Replies:
    6
    Views:
    359
    John Isaacks
    Jul 19, 2003
  3. sophie_newbie
    Replies:
    1
    Views:
    416
    Sion Arrowsmith
    Mar 13, 2008
  4. Replies:
    2
    Views:
    148
    Sean O'Halpin
    Dec 17, 2008
  5. Thomas Wilson
    Replies:
    3
    Views:
    122
    Thomas Wilson
    Apr 14, 2010
Loading...

Share This Page