Closed TechWhizZ199 closed 8 years ago
Yes, you are correct. It has been posted before by Aida. I don't quite get why it's not working though. The webbrowser documentation says nothing about special needs when used on linux. I tried it on kali (python 2.7.3), and there it worked fine. Anyway, i will add a print for the link.
Maybe you were using Linux with a GUI? Linux just on command line doesn't support this (as far as I know).
In a console i wrote: import webbrowser webbrowser.open('http://google.com', new=0)
True
then it opened in the browser(firefox)
Though was it on a Linux distro with a GUI? Like GNOME or KDE? I mean if you just open it in a terminal it will run like normal, though if you do not have a GUI installed at all it may not be able to run,
Ahh yes my mistake, with a GUI. But if you don't have a GUI, what does clicking the link do? confused..
I believe without a GUI clicking the link does nothing since the GUI can't really call up a suitable web browser to open the link with since it is only a terminal.
If the operating system does not have a desktop environment installed it attempts to open the browser with Lynx ( http://lynx.browser.org/ ). Lynx is a terminal browser and does not support the ReCaptcha. If Lynx is not installed I believe it just hangs. But a simple check for the OS to print the URL if the user is on Linux would avoid this. Assuming you are SSH'd into a machine with an SSH client that supports clickable URLs ( https://puttytray.goeswhere.com/ ) then when you click it will open the browser. If the SSH client does not support clickable links, you just copy and paste.
No idea why newlines are not working when posting code here. so https://gist.github.com/Autotonic/6a6020fd5520b3afe71680e31eb8c61c
As you can see I just print the URL anyway and only open if the user is using Windows. We could add detection for a desktop environment, but that is a bit over kill.
LINE: https://github.com/nortxort/pinylib/blob/master/api/tinychat_api.py#L174
I believe this issue was posted once before, though I think it is important for those who are using linux distros. Since the web browser will not automatically launch the link, we should always print out the link nevertheless, so users may click on it to launch manually.