Getting iDevices using instruments got stuck when running through Python subprocess
<p>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.</p>

<p>Below is my simple python script</p>

<pre><code>    import subprocess

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

<p>My terminal screen looks as below when I run the above python command</p>

<pre><code>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.
</code></pre>

<p>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.</p>

<p>Thanks </p>

<p>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. </p>

python ios instruments