python gio等待异步操作完成

发布于 2024-08-30 06:45:51 字数 304 浏览 9 评论 0原文

我必须安装 WebDav 位置并等待操作完成才能继续(它是一个脚本)。 所以我以这种方式使用该库:

location = gio.File("dav://server.bb")
location.mount_enclosing_volume(*args,**kw) # The setup is not much relevant
location.get_path() # Returns None because it's not yet mounted since the call is async

如何等待设备安装?

I have to mount a WebDav location and wait for the operation to be finished before to proceed (it's a script).
So I'm using the library in this way:

location = gio.File("dav://server.bb")
location.mount_enclosing_volume(*args,**kw) # The setup is not much relevant
location.get_path() # Returns None because it's not yet mounted since the call is async

How to wait until the device is mounted?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

执妄 2024-09-06 06:45:51

要等待终止,您需要调用 mount_enending_volume_finishedmount_enending_volume 返回的异步结果对象(或者,如果您想异步操作,您可以向后者传递一个回调,但看起来您想要同步-类似此处的操作)。

To wait for termination, you need to call mount_enclosing_volume_finished with the async-result object returned by mount_enclosing_volume (alternatively, you could pass the latter a callback, if you want to operate asynchronously, but it looks like you want sync-like operations here).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文