0

I am writing a simple python script using Subprocess to get iDevices list attached to my mac. The command I am using is "instruments -s devices". This command works fine when I run through the command line but I am having issues when I use the same command using subprocess.

Below is my simple python script

    import subprocess

    cmd = ['instruments', '-s', 'devices']
    response = subprocess.Popen(cmd,stdout=subprocess.PIPE)
    print response.communicate()

My terminal screen looks as below when I run the above python command

MacBook-Pro-9:lib darren$ python iOSRemoteLib.py
2016-09-05 14:30:38.648 instruments[21276:1052546] WebKit Threading Violation - initial use of WebKit from a secondary thread.

The python process gets hung up and not returning any response. Looks like some threading issue and I am not able to figure out what.

Thanks

slysid
  • 5,236
  • 7
  • 36
  • 59

1 Answers1

0

Do you have two versions of Xcode? I was facing the exact same issue that subprocess(instruments -s devices) hangs. I have both XCode 8.0 and 7.3.1. This issue only happens after I switch to 7.3.1. It turns out subprocess.Popen('sudo instruments -s devices', stdout=subprocess.PIPE) works just fine. So probably a permission issue.