OBS Python script cannot find module error (OBS snap Linux edition)

1.6k views Asked by At

I use OBS Studio 27.1.3-modified snap version in Manjaro Linux and it works normally for everything, except the python scripts I try to add.

The first lines of the python script are:

import obspython as obs 
import pywinctl as pwc # version >=0.0.30

and when I add the script in OBS, I get this error message (pointing to the 2nd line of the script, so the 1st one is found):

error: [Python: zoom_and_follow_mouse.py] Traceback (most recent call last):
error: [Python: zoom_and_follow_mouse.py]   File "/home/slander/OBS Streaming/Scripts/zoom_and_follow_mouse.py", line 2, in <module>
error: [Python: zoom_and_follow_mouse.py]     import pywinctl as pwc # version >=0.0.30
error: [Python: zoom_and_follow_mouse.py] ModuleNotFoundError: No module named 'pywinctl'

Prior to the try, I added pywinctl module using this command (as mentioned in the documentation of the script):

sudo python -m pip pywinctl

And when I re-run this command I have this output:

Requirement already satisfied: pywinctl in /usr/lib/python3.10/site-packages (0.0.33)
Requirement already satisfied: numpy~=1.21 in /usr/lib/python3.10/site-packages (from pywinctl) (1.22.3)
Requirement already satisfied: xlib~=0.21 in /usr/lib/python3.10/site-packages (from pywinctl) (0.21)
Requirement already satisfied: PyRect~=0.1 in /usr/lib/python3.10/site-packages (from pywinctl) (0.2.0)
Requirement already satisfied: ewmh~=0.1 in /usr/lib/python3.10/site-packages (from pywinctl) (0.1.6)
Requirement already satisfied: python-xlib in /usr/lib/python3.10/site-packages (from ewmh~=0.1->pywinctl) (0.31)
Requirement already satisfied: six>=1.10.0 in /usr/lib/python3.10/site-packages (from xlib~=0.21->pywinctl) (1.16.0)

What am I missing?

The OBS instance is launched using an env variable via this line:

env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/obs-studio_obs-studio.desktop /var/lib/snapd/snap/bin/obs-studio

Is the "env" part the problem? How to set the correct path to the python modules for that environment in that case?

PS: I also tried to install modules as local user, but got the same error.

0

There are 0 answers