0

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.

Slander
  • 225
  • 2
  • 13
  • Hi! I don't know if this is too late, and not sure what the problem can be. Have you tried 'python3 -m pip install pywinctl --force-reinstall' or, alternatively, download the wheel file and install it using 'python3 -m pip install wheel-file.whl --force-reinstall'? (I'm affraid python refers to python2, whilst pywinctl module is python3 only) – Kalma May 06 '22 at 18:55
  • This is not too late, the problem is still there... I did a force reinstall using what you suggested, but nothing is changed: still have the same error :( I can add plugins, but not python scripts, very frustrating! – Slander May 07 '22 at 20:13
  • Hi again! I'm not an OBS expert, sorry. Perhaps you are using Python2 while those scripts require Python3. I found a video explaining how to install Python3 and zoom script within OBS: https://www.youtube.com/watch?v=t7RhpvlVte0. Otherwise, I suggest you ask the Zoom-and-Follow script author (tryptech) directly by opening an issue here: https://github.com/tryptech/obs-zoom-and-follow/issues. I know He usually answers all issues. Let me know if you get to make any progress. – Kalma May 08 '22 at 17:22
  • Python3 is installed on my system. I already watched the video before you linked it here, but thanks ;) Anyway, python is correctly installed on my system. I followed the link on gitub to report an issue, and found I was not alone. I posted a message there too. Waiting for a reply/solution still. Anyway, thanks @Kalma – Slander May 11 '22 at 00:58
  • @Kalma, are you by any chance the author of the PyWinCtl module? – Slander May 11 '22 at 01:03
  • yes! hahahaha! But not OBS-skilled, sorry. – Kalma May 11 '22 at 15:03
  • sorry, I didn't see your previous message. I guess you have Python 3.6.8 installed (as per the YT video), right? Do you have other Python3 versions installed on your system? Could you try this: "python3.6 -m pip install pywinctl --force-reinstall" or "python36 -m pip install pywinctl --force-reinstall" or, in case it doesn't work: "cd C:\Program Files\Python\Python36\" and then run previous commands again? This will assure we are installing all modules within Python3.6.8, which seems to be the version this guy is recommending. – Kalma May 11 '22 at 15:52
  • sorry again. You are on Linux! So, replace the "cd C:\Program Files\Python\Python36\" by "cd /usr/bin" and run "python3.6 -m pip install pywinctl --force-reinstall". Do not use "sudo". If required, then add "--user" at the end of the command: "sudo python3.6 -m pip install pywinctl --force-reinstall --user" – Kalma May 11 '22 at 16:32
  • Oh, small world then lol Well I currently have the 3.10.4 version of python in Manjaro Linux. I don't have a "python3.6" binary on my machine. The "python" command is a link to the "python3" or "python3.10" binaries and after reinstalling like you suggested (replacing 3.6 by 3.10), nothing has changed. My python works perfectly fine on my machine, but I suspect the "snap" version to be the problem, as it is launched in a sandbox with a special "env". I hope to find a solution, but I don"t have answers apart yours :( Thank you for your time anyway, really appreciated! I continue to investigate. – Slander May 11 '22 at 18:42
  • By the way, I tried to install python 3.6, but I cannot install modules in it as there is no "pip" for this version on my system. Still investigating... – Slander May 11 '22 at 18:43
  • Hi again! I'm affraid OBS is not compatible with python 3.10 (check https://aur.archlinux.org/packages/obs-studio-git). To get pip in Python 3.6, run this: "wget https://bootstrap.pypa.io/get-pip.py", and then "sudo python3.6 get-pip.py". Please, let me know if this works. – Kalma May 12 '22 at 06:56
  • @Kalma OBS has been supporting Python 3.6 to 3.10 since OBS 28 – ProblemsLoop May 26 '23 at 18:14

0 Answers0