← Back to team overview

sikuli-driver team mailing list archive

[Question #663518]: How can I workaround or resolve - could not import the PyAudio C module '_portaudio'

 

New question #663518 on Sikuli:
https://answers.launchpad.net/sikuli/+question/663518

Hello Sikuli community!

I have a need to capture audio using pyaudio during a test that runs via a sikuli script. I am running on windows 10.

The issue I am stuck on is when this line in my sikuli script runs:
subprocess.Popen(["start cmd C:\\python27\\python.exe", "audio_recorder_popen.py"])
I get this error:
    could not import the PyAudio C module '_portaudio'.
    [error] script [ Desktop ] stopped with error in line 8
    [error] ImportError ( No module named _portaudio )
    [error] --- Traceback --- error source first line: module ( function ) statement 116: pyaudio ( <module> ) import _portaudio as pa
    1: audio_recorder_popen ( <module> ) import pyaudio
    11: test_telephony_sikuliuser21 ( <module> ) import audio_recorder_popen
    [error] --- Traceback --- end --------------

I have tried variations of the Popen but seem to hit the same issue.
If I open a command prompt and run the same python script it works as expected:
    C:\Users\anony\Documents\DesktopAutomatedTesting\Desktop.sikuli>python.exe audio_recorder_popen.py

    recording...
    finished recording

I have copied the entire contents of C:\Python27\Lib\site-packages to C:\Users\anony\AppData\Roaming\Sikulix\Lib\site-packages which didn’t resolve the issue.
I can’t figure out where the PyAudio C module '_portaudio' resides on my system and how to work around this.

I’m hoping there is a way to run the script entirely independent of Sikuli but I’m not sure how to do that. I was thinking subprocess.Popen would be the solution. 



-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.