【发布时间】:2018-07-01 13:03:04
【问题描述】:
当我跑步时
import webbrowser
webbrowser.open('https://google.com')
在 Python 3.7 中,它会在我的默认浏览器中打开损坏的 url:http://openurl%28https//google.com,new-window)。当我在 3.6 中运行相同的代码时,它可以正常工作。这是 Python 3.7 中的错误还是我配置错误?
我正在使用:
- Linux Manjaro
- Python 3.7.0 安装了 pyenv (
env PYTHON_CONFIGURE_OPTS="--enable-shared --enable-optimizations" pyenv install 3.7.0) - Opera 是我的默认浏览器
-
webbrowser.get()返回<webbrowser.Opera object at 0x7f546c22ea90> - 我的os.environ dump
【问题讨论】:
-
您使用的是哪个浏览器?查看源代码,您的 Python3.7 似乎尝试使用......Netscape 或 Opera 来打开 url? github.com/python/cpython/blob/master/Lib/webbrowser.py#L281
-
无法在 Win 7 上的 Python 3.7 上重现
-
另外,
os.environ的输出是什么? -
我在主帖中添加了所有这些信息。
-
此问题在下一个 Python 次要版本中修复!
标签: python python-3.x python-3.7