在某些系统上提供URL时,launch_default_for_uri引发异常

问题描述

我正在使用launch_default_for_uri(从Gio导入的gi.repository函数在用户的默认浏览器中打开URL。在运行postmarketOS的手机和运行Fedora 32的台式机上,此方法效果很好,但是在Alpine Linux虚拟机中,运行它却引发以下异常:

Traceback (most recent call last):
  File "giotest.py",line 3 in <module>
    Gio.AppInfo.launch_default_for_uri("https://stackoverflow.com")
gi.repository.GLib.Error: g-io-error-quark: Operation not supported (15)

这是我最小的可重现示例:

from gi.repository import Gio

Gio.AppInfo.launch_default_for_uri("https://stackoverflow.com")

我想这可能是由于我的虚拟机中缺少依赖项引起的,但是我不确定那是什么。我该怎么做才能在虚拟机上完成这项工作?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)