En Fri, 20 Feb 2009 15:47:06 -0200, david <bing....@gmail.com> escribió:

Basically I have some python scripts to do some document processing,
all in command line tho.
I want to have an C++ application so that my scripts can run in dialogs
(API).
I saw a post before using c# to run python scripts within the c# main.
I am willing to run my python scripts within c++.
Thanks.

So you want to execute a Python script, in a different process, as if you typed the command line? That's not different to executing any other external program in C# - in fact is a C# question, no Python involved. Try something like this:

    Process p = new Process();
    p.StartInfo.FileName = "path\to\python.exe";
    p.StartInfo.Arguments = "path\to\your\script.py other arguments";
    p.Start();
    p.WaitForExit();
    p.Close()

There are other properties you may want to use, like RedirectStandardOutput; see the C# documentation.

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to