Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

'Program exited with status =1' message when trying to login-Linux NixOS #404

Closed
aswan89 opened this issue Aug 1, 2017 · 7 comments
Closed
Labels

Comments

@aswan89
Copy link

aswan89 commented Aug 1, 2017

I'm attempting to log in with RTV on NixOS linux via Terminator. When I press 'U' to login I just receive the message "Program Exited with status=1". I'm assuming this is the webserver backend that handles the OAuth request but I'm not certain if that is the case and what might be causing it to exit prematurely.

@michael-lazar
Copy link
Owner

Thanks, could you please start rtv with the --log option, and paste the log after reproducing the error? My first guess is that RTV isn't able to open your web browser for some reason.

@aswan89
Copy link
Author

aswan89 commented Aug 2, 2017

2017-08-02 18:33:04,826:INFO:__main__.py:101:Environment: [(u'$DISPLAY', ':0'), (u'$XDG_CONFIG_HOME', None), (u'$BROWSER', None), (u'$PAGER', 'less -R'), (u'$RTV_EDITOR', None), (u'$RTV_URLVIEWER', None)]
2017-08-02 18:33:04,826:INFO:__main__.py:118:Using packaged PRAW distribution, commit 3bc535e4778047b78d9aeb2e3a5b108f96a091b2
2017-08-02 18:33:04,841:DEBUG:connectionpool.py:818:Starting new HTTPS connection (1): api.reddit.com
2017-08-02 18:33:05,694:DEBUG:connectionpool.py:395:https://api.reddit.com:443 "GET /.json?limit=1024 HTTP/1.1" 200 62052
2017-08-02 18:33:08,587:INFO:objects.py:197:Loader caught: BrowserError - Program exited with status=1

Looks like my BROWSER environment variable isn't set. I ran it with the command env BROWSER=firefox rtv --log and got the following additions to the log file.

2017-08-02 18:38:45,269:INFO:__main__.py:93:Starting new session, RTV v1.15.1
2017-08-02 18:38:45,270:INFO:__main__.py:101:Environment: [(u'$DISPLAY', ':0'), (u'$XDG_CONFIG_HOME', None), (u'$BROWSER', 'firefox'), (u'$PAGER', 'less -R'), (u'$RTV_EDITOR', None), (u'$RTV_URLVIEWER', None)]
2017-08-02 18:38:45,270:INFO:__main__.py:118:Using packaged PRAW distribution, commit 3bc535e4778047b78d9aeb2e3a5b108f96a091b2
2017-08-02 18:38:45,285:DEBUG:connectionpool.py:818:Starting new HTTPS connection (1): api.reddit.com
2017-08-02 18:38:46,418:DEBUG:connectionpool.py:395:https://api.reddit.com:443 "GET /.json?limit=1024 HTTP/1.1" 200 62126
2017-08-02 18:38:49,800:INFO:objects.py:197:Loader caught: BrowserError - Program exited with status=1

@michael-lazar
Copy link
Owner

Thanks,

It looks like the error is being thrown from here:

https://github.com/michael-lazar/rtv/blob/master/rtv/terminal.py#L506

Essentially what's happening is that RTV is trying to open your web browser in a background process using webbrowser.open_new_tab(). The webbrowser library contains some logic to try to determine which process to launch (firefox, chrome, lynx, etc), but what you set in $BROWSER should take preference. Are you able to run the following command from your terminal? The command should open a new browser tab and stay in the foreground.

firefox --new-tab https://www.reddit.com

If that works, try this next

python -c "import webbrowser;from six.moves.urllib.parse import unquote;webbrowser.open_new_tab('https://www.reddit.com')"

@aswan89
Copy link
Author

aswan89 commented Aug 8, 2017

The firefox command worked fine, the python one did not. I got a moduleNotFoundEffor: No module named 'six'so it appears I don't have that dependency readily available.

@michael-lazar
Copy link
Owner

You probably have more than one version of python installed on your system. If you didn't have six, RTV wouldn't even launch. Try this to get the full path of the python executable:

bash-4.4$ head -n5 $(which rtv)
#!/usr/local/opt/python/bin/python2.7

# -*- coding: utf-8 -*-
import re
import sys
/usr/local/opt/python/bin/python2.7 -c "import webbrowser;from six.moves.urllib.parse import unquote;webbrowser.open_new_tab('https://www.reddit.com')"

@DIzFer
Copy link

DIzFer commented Aug 15, 2017

it appears I don't have that dependency readily available

NixOS is weird with python modules and running the interpreter normally: they normally aren't available in the standard PATH, and instead are made available with wrappers for programs that need them. The solution is to run nix-shell -p pythonPackages.six, the command should work normally from the child shell.

EDIT: To clarify, the command that works is python -c "import webbrowser;from six.moves.urllib.parse import unquote;webbrowser.open_new_tab('https://www.reddit.com')". ALTHOUGH, I just tested running rtv from said shell and firefox opened normally... I'm 99% sure this is a bug in Nixpkgs, and has little to do with rtv itself.

@michael-lazar
Copy link
Owner

Thanks for the info @DIzFer, I'll mark this as resolved unless somebody else can replicate the issue or provide further insight.

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

No branches or pull requests

3 participants