python gio等待异步操作完成
我必须安装 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要等待终止,您需要调用 mount_enending_volume_finished 与
mount_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).