[1.1.1] subprocess.Popen does not seem to work on macOS 10.12+

Asked by Ryan

Hello,

I am in the process of creating a script that will run through various Unreal demos for me - it will launch them with a few arguments and then kill the process. So far, I am focusing on having A process launch with Sikuli on mac.

I have been using subprocess.Popen and I can launch the demo and other apps from the MacOS terminal just fine using Python. When I try the same code in Sikuli, nothing seems to happen - no process opens, the IDE just reappears with no output as if it has successfully completed the script. I have the code to print the output of the process to the screen, but nothing is output.

----------------------
My Code:

import subprocess

com = subprocess.Popen("/Applications/Calculator.app/Contents/MacOS/Calculator", stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

result = com.stdout.read()
print(result)
-----------------------

When running this, I see this output:

2017-09-14 17:15:40.308 JavaAppLauncher[4260:119455] No Info.plist file in application bundle or no NSPrincipalClass in the Info.plist file, exiting

Again, the calc app does not open. However, when I change my code to run one of the Unreal demos I have on my system, I see no output at all, yet I do see other prints I have, such as "I am here" to help me follow the code.

The Unreal demo location for me is here: /Users/test/Desktop/Mac_Unreal4.17/Hallway.app/Contents/MacOS/Hallway

I have been able to use Sikuli on my Win10 machine to do this exact same task - so I know Sikuli is up to the job.

I am running nightly build 2017-09-14 and MacOS 10.13 (Beta 9) 17A360a -- starting to wonder if this is a Beta issue.

Any help or idea would be appreciated - thanks.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#2

I have to confirm (being on macOS 10.12.6)
It does not work neither with the final 1.1.1 nor with the latest 1.1.2 nightly build, saying:

[error] script [ subproc ] stopped with error in line 1 (which is import subprocess)
[error] NameError ( name 'sys' is not defined )
[error] --- Traceback --- error source first
line: module ( function ) statement
1: subprocess ( <module> ) NameError: name 'sys' is not defined
[error] --- Traceback --- end --------------

though apparently the same Jython standalone 2.7.0 is used.

Currently I have no idea, what is going on.

Revision history for this message
RaiMan (raimund-hocke) said :
#3

see linked bug

Revision history for this message
Ryan (ryan-g2) said :
#4

HI RaiMan

Thanks for taking a look at this - I really appreciate it!

I tried out the new build today (1.1.2-SNAPSHOT 2017-09-15_08:24) and I still have the issue - I can't get any process to launch with subprocess.Popen. I also loaded this same version, on the same machine, onto Sierra macOS 10.12.5 and saw the same issue.

I looked around on the github a bit and saw the change was submitted to the Develop branch and not the Master branch. I downloaded the setup.jar file from this page: https://raiman.github.io/SikuliX-2014/nightly.html

I am wondering if that grabbed the Master version and not the branch that the fix went into.

The quick code I wrote to test this out (Hopefully it is not my fault):

import subprocess

subprocess.Popen("/Applications/Calculator.app/Contents/MacOS/Calculator")

Revision history for this message
RaiMan (raimund-hocke) said :
#5

--- 1.1.2 is completely based on the develop branch (the master is static for now and represents 1.1.1 final)

I just downloaded the setup jar from the this page: https://raiman.github.io/SikuliX-2014/nightly.html (testing on macOS 10.12) and ran setup again: it simply works.

So just check what you are using really. The IDE should report the build timestamp in the status line.

Revision history for this message
Ryan (ryan-g2) said :
#6

Hrmmm ok, I will have a look at my setup - I might not have fully cleared out the old version.

Can you help with this problem?

Provide an answer of your own, or ask Ryan for more information if necessary.

To post a message you must log in.