HOWTO : Py_CompileString !?!?!
Werner Schiendl
n17999924.temp.werner at neverbox.com
Thu Jan 30 13:15:31 EST 2003
More information about the Python-list mailing list
Thu Jan 30 13:15:31 EST 2003
- Previous message (by thread): HOWTO : Py_CompileString !?!?!
- Next message (by thread): HOWTO : Py_CompileString !?!?!
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, 30 Jan 2003 09:54:56 -0500, Luc <acid_til at yahoo.com> wrote: Hi, your script does not contain a syntax error. You are calling a non-existent method, but this would not be detected until runtime. So the code compiles well and will cause a runtime error (probably NameError excpetion). If you want try your code for handling syntax errors in scripts, you can for example omit the parentheses for the function definition (or add a second pair like so: def test()(): This should return an error at compile time. best regards Werner -- snip -- > Here is the script in question : > > import FOMath > #FOMath has a method called PointValue() > def test(): > print FOMath.PointdddValue() > > test() > > This should't compile because a syntax error is present... > > The way I compile the code from C++ is done like so : > > //str contains the file that just loaded... > Py_CompileString((char*)str.c_str(), "<test.py>", Py_file_input); > > That's it. It's the way I tought was proper. Might be wrong, that's why I > posted in this group :) > > Cheers, Luc. > >
- Previous message (by thread): HOWTO : Py_CompileString !?!?!
- Next message (by thread): HOWTO : Py_CompileString !?!?!
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list