How can I disable the webbrowser message in python?

后端 未结 2 651
时光说笑
时光说笑 2021-02-04 08:49

In my python program, when I send the user to create a gmail account by use of the webbrowser module, python displays:

\"Please enter your Gmail username: Created new wi

2条回答
  •  独厮守ぢ
    2021-02-04 09:17

    There is an answer to another question that is relevant here.

    You can use

    webbrowser.get().open('https://www.google.com/accounts/NewAccount?service=mail')
    

    I have xdg-open installed (Linux), which led to a message START /usr/lib/firefox/firefox for me when using webbrowser.open(). Using the method above this message is not displayed (and xdg-open is still used).

    This supresses output to stdout. It doesn't suppress output to stderr for all setups though. I still have error messages in the terminal.

提交回复
热议问题