Closed Ram-Z closed 6 years ago
Can you please check and make sure you don't have any old versions installed? I spun up a fresh Arch virtual machine and installed with pip install --user
and it works with and without $BROWSER set. I tried various combinations of running in X, in console and with several different browsers (elinks, firefox, qutebrowser, etc) and it all worked as designed.
Check ~/.local/share and /usr/lib/python*. If on Arch, make sure there's not still a /usr/lib/python3.6 or ~/.local/lib/python3.6 directory (safe to delete since we're on 3.7 now).
What distro are you running? How did you install urlscan?
I'm on Arch with a python3.6 directory, because some packages aren't yet updated and/or have a 3.6 specification. urlscan is in neither when installing via pip --user
(only in ~/.local as it should). I'm running neomutt in tmux and calling urlscan from there. The same happens if I call urlscan with a file containing only links. $BROWSER is defined in .zprofile and exists (tried with links and firefox).
Older versions don't work (0.8.5-0.8.8) at all, throwing a TypeError in /usr/lib/python3.7/webbrowser.py
How are you defining $BROWSER? Meaning, what does the actual line in your profile look like?
BROWSER=qutebrowser
or
export BROWSER=qutebrowser
With the former, it will not work properly because the variable doesn't get added to the environment, so it won't be seen by python's os.environ.
I tried installing zsh, and I sort of was able to replicate your issue, then it went away and it's working fine now :slightly_frowning_face:
If you aren't using export
, please try adding that . If that still doesn't work, would you be able/willing to switch your shell to bash, add export BROWSER=<your browser>
to .bashrc and try it?
Thanks,
export BROWSER="whatever"
. Anyway, echo $BROWSER
always prints whatever
. ~/.zprofile
is sourced when zsh is used as a login shell (via chsh or IIRC sometimes when called from within tmux). The same goes with fish (set BROWSER whatever
then neomutt -> urlscan or urlscan ./file
) and even plain sh: v0.8.9 opens w3m ignoring $BROWSER
, before that there's a Python error.
Yeah, that's exactly the same error that I thought was fixed with 40050c8 ! That's why I had you double check to see if there were some remnants of an old version installed. Sigh. It's frustrating that I'm having trouble replicating it here.
Was urwid installed with pip --user
or using the arch package?
Can you humor me, and try temporarily moving the /usr/lib/python3.6 directory someplace and see if that changes anything?
I'm on Arch, installed urlscan via AUR and edited the PKGBUILD to switch between versions. There should only ever be on version of it installed, which I confirmed with ls /usr/lib/python*/**/urlscan*
.
I am also using zsh. My .zshenv
has export BROWSER=qutebrowser
.
I currently don't have limitted to my work machine (no X). Will see if I can reproduce at home.
Also, please check and see if there are also any old urwid versions hanging around as well.
I cannot reproduce it locally. This machine is running Chakra Linux (which is quite similar to Arch), with urlscan installed with this PKGBUILD.
It should have pretty much the same setup as my work machino, the major difference is that I'm still running urwid v1.3.1 here. Going to upgrade and report back.
Upgrading to urwid-2.0.1 did not break it on my local machine. The other difference is that it's still using python 3.6.4. I don't think I'm going to be able to upgrade to 3.7 though.
It doesn't look like I have a stray urwid on either machines, my .local/lib
only has py2.7 packages and urwid is not one of them.
I don't think anyone started seeing this error until python 3.7, so near as I can tell it was limited to Arch users, so far. Which is why I keep asking people about stray remnants from the upgrade from python 3.6. Caused me an issue with a few AUR or pip --user
installed packages until I cleared out and updated everything that had originally been installed under 3.6.
Moved /usr/lib/python3.6 to /python3.6 and ~/.local/lib/python3.6 to ~/python3.6, reinstalled urlscan 0.8.9 with pip --user
as last time, $BROWSER still ignored.
Hrm. Ok, thanks for trying that. I'll keep poking at it here. I'm running out of things that could be different between our systems. Other ideas? So far we've checked:
pip --user
and via the AUR PKGBUILDAny other ideas what could be different?
I'm on fully updated stock Arch, bash, tmux, i3. Python 3.7 and 2.7 installed. $SHELL=/bin/bash and $TERM=screen-256color or rxvt-unicode-256color when not in tmux. On my laptop it runs successfully both directly on CLI and from mutt.
Aha, wait I think I just found something...standby...
I'll have a go with virtualenv and another with no other python packages on plain tty when I get back to the desk. I have a hunch I can -Syu all this away.
send pgp jorb
On Wed, Aug 15, 2018, 21:00 Scott Hansen notifications@github.com wrote:
Hrm. Ok, thanks for trying that. I'll keep poking at it here. I'm running out of things that could be different between our systems. Other ideas? So far we've checked:
- Looked for old versions of urlscan and urwid in ~/.local/lib and /usr/lib/python*
- Tried different shells and tmux
- Installed via pip --user and via the AUR PKGBUILD
Any other ideas what could be different?
I'm on fully updated stock Arch, bash, tmux, i3. Python 3.7 and 2.7 installed. $SHELL=/bin/bash and $TERM=screen-256color or rxvt-unicode-256color when not in tmux. On my laptop it runs successfully both directly on CLI and from mutt.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/firecat53/urlscan/issues/70#issuecomment-413300336, or mute the thread https://github.com/notifications/unsubscribe-auth/ARiCq5i7RcPRiLh9-zK2uEqMPuJnFhfmks5uRG-xgaJpZM4V91iz .
I think this has something to do with xdg-open. Try this:
mv ~/.config/mimeapps.list ~/
export BROWSER=qutebrowser
urlscan <file>
And try it with different values for $BROWSER. I have qutebrowser set as the default browser in mimeapps.list, and when I move/rename that file, urlscan works again. It was working for me before, because my normal $BROWSER is set to browser.sh
which is just a little script I probably don't need anymore to select the browser I want to use. If I set BROWSER directly to qutebrowser then I see exactly the behavior you're all describing.
SO, looks like I need to figure out why the default browser used by xdg-open is ignored when it's also set as $BROWSER. I think....
Yep, that seems to be the problem. Can't really help much after this. The only workaround for now is to keep different $BROWSER and xdg-mime entries?
Or try unsetting BROWSER. I'm thinking xdg-open should take over and open the default console or graphical browser if one is set.
It does. I'll just set qutebrowser as $BROWSER since I need the variable for other apps for now.
Ok, give the develop branch a try if you can. Found the bug. My own, of course :smile: It should work properly now, regardless of what BROWSER or the default xdg-open browser is set to. BROWSER takes priority, but xdg-open should kick in if BROWSER is not set.
Back on my work machine.
And try it with different values for $BROWSER. I have qutebrowser set as the default browser in mimeapps.list, and when I move/rename that file, urlscan works again.
I can't find any place where my default browser is set, none of the mimemaps file exists. However xdg-open query default x-scheme-handler/http
does return "qutebrowser.desktop". The only place I can see this listed is in /usr/share/applications/mimeinfo.cache
which, interestingly enough, does not list "w3m" (the browser that is opened by urlscan currently).
Ok, give the develop branch a try if you can.
That seems to fix it for me. Thanks.
Thanks for your patience while I worked through this one!
Since 0.8.9, my BROWSER environment variable is ignored. And "urlscan" simply opens w3m. BROWSER is set to
qutebrowser
in my.zshenv
.It worked in 0.8.5, which is what I was using before. I also tried 0.8.8 which worked fine too.