Multiline command line parsing

B

Brad Johnson

I am implementing a Python command line from scratch in a Win32 application.

Examples online ("How do I tell incomplete input from invalid input" in the
Extending and Embedding Python FAQ) show how to implement this from scratch
using C code. The examples don't work.

This brief snippit illustrates the problem:

char* code = "class Foo:\n"
"\tdef Bar():\n";
PyObject* temp = PyRun_String(code, Py_single_input, glb, loc);

The syntax is completely valid, but should return an "unexpected EOF while
parsing" (which I can handle). However, I receive "expected an indented block."

Shouldn't this example work as stated? Is there something I am missing about my
indentation technique, or any specific Win32 issues lurking?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top