naming the main module in embedded Python

T

Tomasz Koziara

Hi

I am embedding Python as an interpret in my code. Now, whenever my
code or Python itself issues an error/warning message I am getting
something like:

File "<string>", line 1, in <module>

or

__main__:46: RuntimeWarning: My warning message

I am using PyRun_SimpleString to load part of the code and the I call:

sprintf (line, "execfile ('%s')", path);
error = PyRun_SimpleString (line).

The question is: how can I set up the module name or input file name
so that my error/warning messages output them rather than the above
default values?

Thanks
Tomek
 

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

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top