OBS + Portable Python installation

ASchneider

Member
Hello guys!

I was wondering if it possible to setup a portable version of OBS using a local/portable installation of Python, used to run scripts, so I can create a fully functioning zip file to send to my friend for him just to unzip and run it, without having to install Python in his system.

I've found this project - https://github.com/winpython/winpython

I've tried to unzip it inside the OBS portable version and point the Python path to there but it did not worked...

Can someone help me?

Thanks!
 
How did this work using an exe? Did you install it and select the OBS folder? Help would be appreciated as I am dealing with the same problem.
 
@jeffsfolio just use official builds of the Python that has the word "embeddable" in its name. The OBS v27.0.1 indeed looks only for the Python v3.6.x libraries (not older not newer).

So,
  1. Scroll down the Python download page to find something like "Python 3.6.7" and download the "Windows x86-64 embeddable" zip file (for the 64-bit OS you will get the "python-3.6.7-embed-amd64.zip" file). Unpack .zip contents to the folder you have access to, and point OBS main menu Tools>Scripts>Python Settings tab>Python Install Path (64bit) to the folder where the unpacked "python36.dll" lies.
  2. Exit the portable OBS. New entry will appear in the config\obs-studio\global.ini file from the portable folder of OBS. Use the "Notepad++" application to open and edit it. You'll see at the bottom something like this:
    Code:
    [Python]
    Path64bit=C:/Temp/python-3.6.7-embed-amd64
    change it to the relative path, like this (the path from the "obs64.exe" file folder to the "python36.dll" file folder):
    Code:
    [Python]
    Path64bit=../../../python-3.6.7-embed-amd64
    in the example above the portable OBS was in the C:\Temp\OBS-Studio-27.0.1-Full-x64 folder.
    Save the changes to the modified global.ini file.
  3. Export your current Scene Collection (with scripts added).
    Open your just exported Scene Collection file (.json) in "Notepad++". Find the string "scripts-tool". You'll see something like this:
    Code:
    "scripts-tool":[{"path":"C:/Temp/OBS-Studio-27.0.1-Full-x64/data/obs-plugins/frontend-tools/scripts/url-text.py"
    change it to the relative path, like this (the path from the "obs64.exe" file folder to the "url-text.py" file):
    Code:
    "scripts-tool":[{"path":"../../data/obs-plugins/frontend-tools/scripts/url-text.py"
    in the example above the relative path is the same for any installation of the OBS v27.0.1
    Save the changes to the modified .json file (your exported Scene Collection).
  4. Move together the OBS+Python to new folder/PC.
  5. Run portable OBS and import the modified (in p.3) Scene Collection. New Scene Collection will appear in the menu of Scene Collection of OBS (usually, there is number counter added to the old name). Switch to this imported Scene Collection.
  6. Use python scripting.

Yeah, not simple... Otherwise program will fail to load the scripts (absolute path to the "scripts-tool" saved in the scene). OBS has some bugs in this part. I even catch the crash with the standard script "url-text.py"+python v3.6.7:
Code:
Thread 308: (Crashed)
Stack            EIP              Arg0             Arg1             Arg2             Arg3             Address
000000000018F020 000007FEDA1218BF 0000000000000000 000007FEE6770318 000000000018F078 000000000CC99C00 obs-text.dll!<lambda_880baa1155d709808c7f0b661ebf8f8d>::operator()+0xcf
000000000018F050 000007FEE672BBE7 0000000002685F60 000000000018F670 0000000000000000 0000000000000000 obs.dll!obs_source_destroy+0x1d7
000000000018F150 000007FEE673DDFC 0000000000000000 0000000000000160 00000000002687A0 000007FEE672112C obs.dll!obs_free_data+0x5c
000000000018F180 000007FEE6741958 0000000000000000 000000000018F450 000000000018F670 000000000018F5A0 obs.dll!obs_shutdown+0x3d8
000000000018F1D0 000000013FDE911A 000000000018F2A0 000000000018F5A0 000000000018F670 000000000028D0B0 obs64.exe!OBSApp::~OBSApp+0x5a
000000000018F200 000000013FDF451E 0000000000000000 0000000000268600 0000000000000000 0000000000253B60 obs64.exe!run_program+0x93e
000000000018F570 000000013FDF62A1 0000000000261B30 0000000000000000 0000000000000000 0000000000000000 obs64.exe!main+0x591
but this is the best method I found as for today (OBS v27.0.1).
 
Back
Top