sys.exit() and PyRun_SimpleFileExFlags()

X

Xavier Bénech

Hi,

There is a behaviour I do not understand of PyRun_SimpleFileExFlags(),
normally when it executes a python script containing a sys.exit(), it
results by ending the calling application.

I have got this behaviour with PyRun_SimpleFileExFlags() when I call it
from the main thread of a GUI application (so I use PyRun_FileExFlags()
in this case).

But in another application when it is called
(PyRun_SimpleFileExFlags())) from a working thread (not the main one) of
a console application, everything just go fine without exiting the
application nor the thread. It returns the exit code specified in
sys.exit() just fine.

Last things, I am working on Windows. And for the story, I started to
make a small function to wrap some embedded python script call using the
simple way with PyRun_SimpleFileExFlags() for the second application,
but when I integrate it in the first one (with GUI) got some problems
:))) so I redo things with a cleaner PyRun_FileExFlags() call.

So, my question is: why do I have different behaviour of
PyRun_SimpleFileExFlags() in this two cases?

Regards,
Xavier Benech.
 
A

Aahz

There is a behaviour I do not understand of PyRun_SimpleFileExFlags(),
normally when it executes a python script containing a sys.exit(), it
results by ending the calling application.

If nobody responds on c.l.py, I suggest trying capi-sig.
 

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,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top