+ 22

Python and Webbrowser

How can I access the internet with Python? Unfortunately, “import webbrowser”... webbrowser.open ("https://news.google.com/?pt1=true#0") or “open.Webbrowser ...” does not work. Does somebody has any idea? Thank you.

7th Aug 2018, 1:14 PM
embi
embi - avatar
22 ответов
+ 12
Thank you for your answer. I tried it with selenium. An error message did not come! Presumably, the system still needs to know which browser.?! Thanks first for your quick reply. 👍👍👍 I will look again.😉
7th Aug 2018, 4:23 PM
embi
embi - avatar
+ 12
But one question is completely unclear to me. If I enter "Python WebBrowser Most Recent" then I get 6 programs from the last 2 years, all of which look similar: "import webbrowser a = webbrowser.open ( "www.google.com") print (a) But not a single code works. It must have worked at least once, at the time of publication. Why does not this work anymore?
8th Aug 2018, 6:20 AM
embi
embi - avatar
+ 12
Thank you. Very helpful your answer.
8th Aug 2018, 10:26 AM
embi
embi - avatar
+ 12
yes Shane Umayanga you are right. 😉 Instead of answers, I only get stupid questions. Only Jason Edelson was very helpful. Thanks again. Luckily I'm very close to the solution.👍
8th Aug 2018, 3:40 PM
embi
embi - avatar
+ 11
Jason Edelson Many thanks for your effort. I will try it (probably not today). THANK YOU👍👍👍😉
7th Aug 2018, 5:58 PM
embi
embi - avatar
+ 11
Okay. Thank you. What do you mean with Idle?
8th Aug 2018, 6:36 AM
embi
embi - avatar
+ 11
And all the other coders who published the programs knew about the problem?
8th Aug 2018, 6:39 AM
embi
embi - avatar
+ 11
Thanks a lot for your efforts. Then Python most likely is out of the question for me. EDIT: (if I can not find another solution)
8th Aug 2018, 6:56 AM
embi
embi - avatar
+ 10
Jehan Khan (for your Answerer Badge)
9th Aug 2018, 8:12 AM
embi
embi - avatar
+ 9
I don‘t know. Please tell me.
8th Aug 2018, 9:12 AM
embi
embi - avatar
+ 8
Apple Blossom Many thanks for your response. I guess we speak from Linux. I have Linux on my laptop for years and then I would know to help me too. Now that wanted to do it with my mobile phone. And I also found a way. Will this work out in the near future. But I'm very grateful for your solution. Thanks a lot. 👍👍👍😉
10th Aug 2018, 6:39 PM
embi
embi - avatar
+ 7
import requests if you want to work with html. if you want to actually open a browser import selenium
7th Aug 2018, 3:41 PM
JME
+ 6
Why do people think Google = The Internet?
8th Aug 2018, 9:11 AM
N00B
+ 5
If anyone is still trying to figure it out and needs an example here make sure your driver is in the same location as your .py code https://code.sololearn.com/cBTUjTaGSlqr/#py
7th Aug 2018, 5:41 PM
JME
+ 4
Idle is the default editor/shell that comes with python when downloaded. Possible issues are fixed as long as path to browser is provided
8th Aug 2018, 6:54 AM
JME
+ 4
Kebap that's programming 😂
8th Aug 2018, 3:27 PM
Shane Umayanga
Shane Umayanga - avatar
+ 3
Tried that exact code in Idle and it worked. Opened google and outputted true. I believe if you have no default browser set you will encounter an error, trying on linux may also have issues.
8th Aug 2018, 6:32 AM
JME
+ 3
I would recommend You to use ,,grab" lib
11th Aug 2018, 1:35 PM
root
root - avatar
+ 2
embi Why do you want to open google news website with python? What is your end goal here?
8th Aug 2018, 10:26 AM
Kebap
Kebap - avatar
+ 2
ydkfuthhgwnsigdtly2yhyswu5rbv
9th Aug 2018, 7:03 AM
Jehan Khan
Jehan Khan - avatar