Closed rpolve closed 3 years ago
Give this commit a try. It removes a workaround I had in place to fix an old python webbrowser module bug that has since been fixed. I haven't checked yet if this will cause issues for python versions < 3.7, though.
Thank you for your time. Unfortunately it didn't work.
This is what I did:
mkdir _test && cd _test
git clone --single-branch --branch "browser_var_empty" https://github.com/firecat53/urlscan/
cd urlscan
./setup.py install --root=".."
cd ..
echo www.test.com > test
usr/bin/urlscan -r 'echo $BROWSER {} > output' test
$ python --version Python 3.8.2
Same problem here, python 3.7 only
@rpolve I only deleted the line del os.environ['BROWSER']
in urlchoose.py and that fixed the issue for me.
What the point to remove this environment var by the way ?
@soifo - can you please try my browser_var_empty
branch and @ryneeverett's PR? Neither have the del os.environ['BROWSER']
line.
@rpolve - can you also try @ryneeverett's PR? And maybe my branch again? I really have no idea why it wouldn't be working for you.
The bug report says that this bug has been closed since 2018, which is why I deleted the whole section in browser_var_empty
.
The bug report says that this bug has been closed since 2018, which is why I deleted the whole section in browser_var_empty.
I'd also be fine with deleting the whole workaround. I suspect it wasn't backported to pythons before 3.7 so an update to the README might be in order if you choose this route.
Rereading the report, the bug was only introduced in development at the time so it wouldn't have been present in earlier versions.
@rpolve - can you also try @ryneeverett's PR? And maybe my branch again? I really have no idea why it wouldn't be working for you.
Testing both @ryneeverett 's revision and the browser_var_empty
branch now gives me this:
$ usr/bin/urlscan test.txt
Traceback (most recent call last):
File "usr/bin/urlscan", line 205, in <module>
main()
File "usr/bin/urlscan", line 189, in main
tui = urlchoose.URLChooser(urlscan.msgurls(msg),
TypeError: __init__() got an unexpected keyword argument 'single'
I suspect I'm doing something wrong here, but I don't understand what.
Yeah, something doesn't smell right. Maybe start completely over. Make sure urlscan is deleted both from /usr/lib/python3.8/site-packages, /usr/bin, /usr/local/bin/, ~/.local/bin/ and from ~/.local/lib/python3.8/site-packages. Completely remove the _test directory and then repeat the steps you posted above.
Sorry for the late reply but I wanted to make sure to get back on the same machine, the other where I tried this must have missed some dependency that I couldn't identify...
I've tried the procedure previously decribed both with the browser_var_empty
branch and with @ryneeverett 's revision, but the result is still the same as described in the original post, unfortunately.
I'm going to push the browser_var_empty patch to master because I still believe that it should fix your issue, as there is no longer any code that affects the value of $BROWSER. Install urlscan to your system (instead of just to a local directory) and try again. Ensure $BROWSER is set either in .bashrc or in the current terminal session you are using.
As an aside, can I ask what exactly were you trying to accomplish when you found this issue?
I'll leave this issue open for now.
I'm going to push the browser_var_empty patch to master because I still believe that it should fix your issue
Yes, you were right. Doing a fresh system install from git solved the problem.
I apologize for having been less than effective at debugging this.
can I ask what exactly were you trying to accomplish when you found this issue?
I think I forgot, but probably not anything specific. If I'm not mistaken I encountered this problem when I was trying to hack at this other issue.
No worries, glad it worked for you finally.
After reading your neomutt issue, I'd suggest that you maybe add to your issue what you were originally trying to accomplish. Sometimes just having the steps to reproduce without some context makes debugging more challenging
Expected behaviour:
Open $BROWSER to the desired URL
Actual behaviour:
Var $BROWSER is empty, you can see it by doing for example
urlscan -r 'echo $BROWSER {} > plpl' test.txt; cat plpl
I've seen that other environment variable aren't empty (I tried a few, for example $TERMINAL and $EDITOR)
How to reproduce:
Have either
export BROWSER=firefox
in your shell rc orBROWSER=firefox
in /etc/environmentHave a linkhandler script which can be as simple as:
urlscan --run 'linkhandler {}' test.txt
Extra info:
I tried piping it too, but with no result:
urlscan --run 'xargs linkhandler' --pipe test.txt
Version: