Added python path but runner cannot find external modules

Hello,
I am setting an experiment through the builder where I have a python code routine that dynamically generates my stimuli. The code is calling an external python script through the subprocess python module.

So far so good. The code is running but it is using modules which are not part of psychopy (eg. h5py). So in order to solve that issue and to run it smoothly across the team (different computers), I have created a ‘modules’ folder in the working directory and downloaded my modules there (at the last version compatible with python 3.6). Then I added the path directly in my code before calling the external script:

sys.path.append(os.path.join(os.getcwd(),’modules’))

When I print the system path, it is correctly added but the error remains:

ModuleNotFoundError: No module named ‘h5py’

I also tried previously to add the absolute path directly to the preferences but I got the same error. How to get psychopy to look in that folder for ressources?

I have actually fixed this issue by adding the relative system path directly into the script itself. So once called into psychopy environment, the script imports the compatible dependencies from the ‘modules folder’.

At the moment, it seems to be the most portable solution. But if anyone else has a better suggestion I am all ears :slight_smile:

Hi, I was having problems with importing the external module (UniversalLibrary). I had used the path : C:\Users\LENOVO\Downloads\PyUniversalLibrary-20061020\PyUniversalLibrary-20061020\UniversalLibrary but while running the builder I got the error AttributeError: module ‘UniversalLibrary’ has no attribute ‘FIRSTPORTA’.
Am I adding the path in wrong way? Thanks in Advance.
Regards,
Drish