Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Webbrowser
#1
New member here - Thanks in advance.

I am using Sublime Text, wrote the below. Help me get this to open google!

import webbrowser
webbrowser.open("www.google.com")

I saved this to my desktop as a python file. When I double click it, nothing happens.
Reply
#2
Use Code tags.
(Sep-26-2020, 07:44 PM)jbrick97 Wrote: I saved this to my desktop as a python file. When I double click it, nothing happens.
Do get used to run code from command line and not trough double click.
Check python version then run file.
# web_b.py
import webbrowser

webbrowser.open("www.google.com")
E:\div_code\new
λ python -V
Python 3.8.3

E:\div_code\new
λ python web_b.py

E:\div_code\new
I use cmder here same in cmd.
So if no errors the only thing that's happens is that that it open googl.com in your default web-browser.
Reply
#3
I guess I'm not sure what you're saying here .. sorry
Reply
#4
The bottom line is: you need to tell the Python interpreter to run your program, which you do on the command line.

What operating system are you running? Have you actually installed Python? If not, how do you expect to run Python programs?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Webbrowser.open() causes errors ChrisOfBristol 1 843 Apr-09-2023, 08:34 PM
Last Post: deanhystad
Question How to get html information from a tab of my default browser opened with webbrowser? noahverner1995 2 4,336 Jan-14-2022, 10:02 AM
Last Post: noahverner1995
  How to get a URL from python 'webbrowser'? dheeraj 0 1,816 Apr-05-2021, 03:55 PM
Last Post: dheeraj
  Making WebBrowser In PySide2 Harshil 0 1,876 Sep-16-2020, 05:03 PM
Last Post: Harshil
  webbrowser and menu not working. sik 1 1,803 Oct-31-2019, 03:39 AM
Last Post: newbieAuggie2019
  Web scraping: webbrowser issue Truman 10 6,963 Jul-11-2018, 11:57 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020