question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Streamlink fails to run when using certain wrapper scripts

See original GitHub issue

Bug report

  • I understand the difference between Streamlink and Streamlink Twitch GUI.
  • This is a bug report and I have read the contribution guidelines.

Environment details

Operating system and version:
NixOS 19.09

Streamlink Twitch GUI version:
1.9.1

Streamlink version:
1.3.1

Description

I’m attempting to write a Nix derivation for streamlink-twitch-gui, and having an issue with the automatic handling of wrapper scripts. I’m not sure if this may be an issue with the shebang type being different on NixOS or a different problem, but either way streamlink-twitch-gui refuses to run the script unless I manually set the path to the “unwrapped” binary in the settings. For reference, here is the wrapper script:

#! /nix/store/kgp3vq8l9yb8mzghbw83kyr3f26yqvsz-bash-4.4-p23/bin/bash -e
export PATH='/nix/store/syqcp8zb9c0vxj2sx6jbv5f9q7yki4jz-python3-3.7.7/bin:/nix/store/7lc2j0zxq6hakf89swr08a6jvdnmvk24-streamlink-1.3.1/bin:/nix/store/wyvzykym54601iry33v05hzp864cbqzi-python3.7-chardet-3.0.4/bin:/nix/store/qfi1h97flkdax6ag0n0aj7545xcivr5g-python3.7-setuptools-45.2.0/bin:/nix/store/n8nw2xs2q4vk8ybd0yj3f333fr74ixdd-python3.7-websocket_client-0.56.0/bin:/nix/store/kc74iz3k6j67vr2lxfdrj2m3ww5hd1qh-openssl-1.1.1f-bin/bin:/nix/store/ybv5a5mbalj3791l1w3v2jy452n58vf1-rtmpdump-2019-03-30/bin:/nix/store/2sfcwvmmg3pj4pyqgf81ikf1l6jbn41c-ffmpeg-3.4.7-bin/bin'${PATH:+':'}$PATH
export PYTHONNOUSERSITE='true'
exec -a "$0" "/nix/store/7lc2j0zxq6hakf89swr08a6jvdnmvk24-streamlink-1.3.1/bin/.streamlink-wrapped"  "$@"

Setting the path to “.streamlink-wrapped” manually in the settings fixes it temporarily, but is an annoying workaround since the built derivation path for streamlink will change with updates.

Expected / Actual behavior

I expect streamlink-twitch-gui to be able to use the wrapper script as expected, and run streamlink.

Reproduction steps

  1. Use the nix derivation I’ve created (see here for the current state).
  2. Run the built derivation binary and attempt to launch a stream.
  3. Get the error.

Log output

[error][StreamingService]
ProviderError: Couldn't validate python script
Executables were not found

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
rileyinmancommented, Jun 1, 2020

Hi! Sorry this took me so long to get back around to, I unfortunately haven’t had much luck getting the yarn build to work (the node ecosystem is still a bit difficult to work with on NixOS) but this will make packaging the binary releases work much better. I just tested it and the new release works great! Thanks so much for your help 😄

0reactions
bastimeyercommented, May 16, 2020

Just a quick note regarding the streaming provider config: I guess the unnecessary complexity with the custom python module script resolver can be removed, as it’s not necessary anymore. I will see if I can rewrite the resolver config to a simpler one this weekend, which should make patching custom stuff required by packages like this much easier. Most causes of the notorious “invalid version string output” error will also be fixed by that, as there won’t be room for invalid python path configs.

To explain this a bit more in detail, the Streamlink python and python script resolver had to be implemented in the past due to an issue on Windows related to the Streamlink launcher file, as it had the wrong python executable hardcoded, which caused it to always spawn a terminal window, which was unacceptable for the Twitch GUI. The system-independent solution was to find Streamlink’s python entry module script file and get the path of the python executable from its shebang at the top and replace the executable name with the proper one on Windows and launch python with the module script as first parameter. An additional step also had to be implemented for macOS’s homebrew package, as it uses a BASH script wrapper to set an additional python env var. This is where the wrapper script “support” comes from.

Since my pull request with a fix got merged last year into Streamlink’s Windows installer dependency pynsist, this resolver workaround wasn’t needed anymore, as there were two separate Streamlink launchers now, and the additional “streamlinkw” resolver config as added. It was basically the same as the old Livestreamer resolver config, because Livestreamer never had this problem. It got removed a few months later though, as it became fully incompatible with Twitch.

The remnants of this whole nonsense is the current situation with two separate resolver configs, one of them being a workaround that isn’t needed anymore but works fine (except for situations as described in this thread) and one resolver config for Windows which would also work on all OSes, but only has Windows related data set.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changelog - Streamlink 5.1.2 documentation
Streamlink 1.4.0 comes with lots of plugin fixes/improvements, as well as some new features and plugins, and also a few plugin removals. Notable...
Read more >
write using import streamlink module OR by runnong ...
What I am essentially trying to do is capture a live video from a specific youtube channel. I ONLY CARE ABOUT THE AUDIO,...
Read more >
streamlink/streamlink - Gitter
if I am using streamlink.exe does it actually use "plugins/twitch.py"? because changing the line to TWITCH_CLIENT_ID = "kimne78kx3ncx6brgo4mv6wki5h1ko" did ...
Read more >
Wiki - Getting Started With OBS Scripting
OBS can be extended with Python and Lua scripts. This set of pages explains the basics to get started and describes how to...
Read more >
Index of Portage & Programming - Gentoo Forums
Index of Portage & Programming. "Allow remote access to mySQL" Page:1 · "binary packages for different use flags?" Page:1 · "Question about LVM2...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found