[Ironpython-users] Using System.Diagnostics.Process results in Errno 22

Jackie Sproat JackieSproat at smarttech.com
Wed Dec 19 15:48:23 CET 2012


Thanks os.popen is working for me!

From: Curt Hagenlocher [mailto:curt at hagenlocher.org]
Sent: Wednesday, December 19, 2012 7:32 AM
To: Jackie Sproat
Cc: ironpython-users at python.org
Subject: Re: [Ironpython-users] Using System.Diagnostics.Process results in Errno 22

Arg, bitten again by "reply-to"!

You might need to supply a full path to java.exe in the file name.

The "os.exec*" family of functions should work on IronPython, as should "os.system".
On Wed, Dec 19, 2012 at 6:19 AM, Jackie Sproat <JackieSproat at smarttech.com<mailto:JackieSproat at smarttech.com>> wrote:
Curt,
Thanks for the suggestion. I believe you are right.  I no longer get the error message, but the command itself is not successful.
Is there any other way in IronPython to run commands ?

Cheers,
Jackie

From: Curt Hagenlocher [mailto:curt at hagenlocher.org<mailto:curt at hagenlocher.org>]
Sent: Tuesday, December 18, 2012 4:03 PM
To: Jackie Sproat
Subject: Re: [Ironpython-users] Using System.Diagnostics.Process results in Errno 22

I believe StartInfo.FileName really needs to be a file name, and not a command line. Set it to java.exe and put everything else into Arguments.
On Tue, Dec 18, 2012 at 1:54 PM, Jackie Sproat <JackieSproat at smarttech.com<mailto:JackieSproat at smarttech.com>> wrote:
Using python I have no problem starting my process with subprocess.Popen('java -jar "C:\Program Files (x86)\Sikuli X\sikuli-script.jar" ' + finalname, shell=True)

But, because the select module is not available, you can't use the subprocess module in IronPython.
So, I have to use System.Diagnostics.Process instead.

However, using this with IronPython, results in Errno 22: The system cannot find the file specified...

    file_name = 'java -jar "C:\Program Files\Sikuli X\sikuli-script.jar" '
    file_name = "\"" + file_name + "\""
    try:
        p = Process()
        p.StartInfo.UseShellExecute = True
        p.StartInfo.RedirectStandardOutput = False
        p.StartInfo.FileName = file_name
        print p.StartInfo.FileName
        p.StartInfo.Arguments = arg_file
        print p.StartInfo.Arguments
        p.StartInfo.WorkingDirectory = cwd_is
        p.Start()

Any suggestions greatly appreciated.
Cheers,
Jackie

_______________________________________________
Ironpython-users mailing list
Ironpython-users at python.org<mailto:Ironpython-users at python.org>
http://mail.python.org/mailman/listinfo/ironpython-users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20121219/8fe0ae07/attachment.html>


More information about the Ironpython-users mailing list