WSL 不会将我重定向到 Google Chrome。

huangapple go评论53阅读模式
英文:

WSL doesn't redirect me to google chrome

问题

为了使我的脚本成功运行,我需要插入API重定向我到的站点的URL。在我的Windows Powershell中一切都正常,我运行我的代码,我的Google Chrome标签页打开,我成功复制地址,然后完成。但当我在WSL(Windows子系统)上运行这段代码时,完全没有任何反应。也许它需要某些权限来使用Chrome?它肯定有访问互联网的权限。

我尝试搜索“Chrome WSL访问”,但没有找到有用的信息。

英文:

In order for my script to run successfully, I need to insert the URL of the site that the API redirected me to. Everything works in my Windows Powershell, I run my code and my Google Chrome tab opens, I successfully copy the address and you're done. But when I run this code on WSL(Windows Subsystem for Linux) absolutely nothing happens. Perhaps he has some permissions to use Chrome? He certainly has access to the Internet.

I tried searching for "Chrome WSL Access" but didn't find anything helpful.

答案1

得分: 0

这似乎是你正在运行一些代码,最终调用了spotipy/oauth2.py#L432,其中包含以下行:

def _open_auth_url(self):
    ...
    webbrowser.open(auth_url)
    ...

我怀疑问题是由于 webbrowser 当前无法在WSL上运行,这在这个问题中有跟踪记录:
https://github.com/python/cpython/issues/89752

你可以尝试查看是否可以以非交互方式实现你想要的目标。似乎有一些方法,包括一个 open_browser 参数,你可以尝试在某个地方将其设置为 False

英文:

It looks like you're running some code that eventually calls the spotipy/oauth2.py#L432, which has this line in it:

def _open_auth_url(self):
    ...
    webbrowser.open(auth_url)
    ...

I suspect the issue is due to webbrowser not currently working with WSL, which is tracked in this issue:
https://github.com/python/cpython/issues/89752

You could try to see if you achieve what you want non-interactively. There seems to be some methods including a open_browser parameter, which you can perhaps set to False somewhere.

huangapple
  • 本文由 发表于 2023年3月21日 03:16:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/75794418.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定