Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Couldn't validate python script error message on OS X #459

Closed
4 tasks done
jhanssen opened this issue May 24, 2017 · 10 comments
Closed
4 tasks done

Couldn't validate python script error message on OS X #459

jhanssen opened this issue May 24, 2017 · 10 comments

Comments

@jhanssen
Copy link

Checklist

  • This is a bug report.
  • Streamlink is working correctly on my system without using the Twitch GUI.
  • I tried solving my issue by reading the project's wiki first.
  • I used the search function to find already opened/closed issues or pull requests.

Description

I started getting an error message saying Couldn't validate python script when launching twitch streams after upgrading from 1.2.1 to 1.3.0. Downgrading to 1.2.1 makes the problem go away.

Reproduction steps

  1. Open the app
  2. Select a stream and try to watch it

Environment details (operating system, etc.)

Streamlink Twitch GUI 1.3.0, OS X, Python 3.6.1, streamlink installed from pip.

Comments, logs, screenshots, etc.

The log file contains entries like the following

[2017-05-24T02:40:57.084Z][error][StreamingService]
Error: Couldn't validate python script
    at n.a (chrome-extension://kjlcknihpadniagphehmpojkkdigigjp/main.js:7:192748)
@bastimeyer
Copy link
Member

bastimeyer commented May 24, 2017

Do you have custom paths set in the settings menu?
Could you please post the results of

which streamlink
head -n 1 "$(which streamlink)"

@jhanssen
Copy link
Author

I tried several different paths, right now my custom paths are /usr/local/opt/python3/bin/python3.6 for Python executable and /usr/local/bin/streamlink for Streamlink python script.

$ which streamlink
/usr/local/bin/streamlink

$ head -n 1 $(which streamlink)
#!/usr/local/opt/python3/bin/python3.6

$ /usr/local/opt/python3/bin/python3.6 --version                                                                      ⏎
Python 3.6.1

@bastimeyer
Copy link
Member

I can't think of a possible reason right now why this shouldn't work. Unfortunately, the error message doesn't tell you what exactly is failing here. I'll see if I can improve this in the next release.

Could you please run a dev build and set a break point in this line:

throw new ProviderError( "Couldn't validate python script" );

Instructions can be found here...

Thanks

@jhanssen
Copy link
Author

Sure, I might not have time tonight. I did a bit of digging though and see that the following exception is raised:

{ "errno": -2, "code": "ENOENT", "syscall": "stat", "path": "/usr/local/opt/python3/bin/python" }

There's no python file in /usr/local/opt/python3/bin/, but there is a python3 file there and also a python3.6 file which is the one my custom path is set to. Hopefully this is sufficient, otherwise I can do more debugging tomorrow.

@bastimeyer
Copy link
Member

Thanks. This is exactly what I need. 👍
See here:

// don't use the shebang directly: Windows uses a different python executable
const pythonPath = dirname( shebang );
// look up the custom Windows executable in the shebang's dir
const exec = await whichFallback( providerConfigExec, pythonPath, null, true );

The reason for this logic is that there are two python executables on Windows. One which requires a Windows command prompt (python.exe) and one normal one (pythonw.exe). Unfortunately, the shebang in the streamlink script on Windows is including the wrong one and that's why only the dirname is being used here. The expected executable name is then added to that path. This works when the python executable name is the same as the expected one(s), which is usually the case on all supported OSes:

"exec": {
"win32": "pythonw.exe",
"darwin": "python",
"linux": "python"
},

This can be fixed by either adding python3 (and python2) to the list of expected executable names, or by improving the resolver logic, so that it also checks the explicit path in case of an error.

@jhanssen
Copy link
Author

Aha, thanks for the detailed info. I created a python symlink in /usr/local/opt/python3/bin and streams are indeed launching now. I can live with this as a workaround until this gets fixed.

@bran
Copy link

bran commented May 24, 2017

This doesn't seem to be working for me as my UI config seems to be pointed to the correct python versions:

/opt/local/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5
and
/opt/local/Library/Frameworks/Python.framework/Versions/3.5/bin/streamlink

Yet I'm still getting that error.

@bran
Copy link

bran commented May 24, 2017

$ ls /opt/local/Library/Frameworks/Python.framework/Versions/3.5/bin/

2to3 idle3 pip3.5 python3-config python3.5m-config
2to3-3.5 idle3.5 pydoc3 python3.5 pyvenv
easy_install pip pydoc3.5 python3.5-config pyvenv-3.5
easy_install-3.5 pip3 python3 python3.5m streamlink

@jhanssen
Copy link
Author

jhanssen commented May 24, 2017

@bran The problem I was having was that the app would take the dirname from streamlink and append python to that and not using the one specified in the UI. If you're having the same problem then making a symlink from python3.5 to python in /opt/local/Library/Frameworks/Python.framework/Versions/3.5/bin/ should fix this. I.e.

cd /opt/local/Library/Frameworks/Python.framework/Versions/3.5/bin/
ln -s python3.5 python

@bran
Copy link

bran commented May 25, 2017

@jhanssen yep can confirm this works! Thanks for clarifying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants