【问题标题】:Microsoft Face API Python poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failedMicrosoft Face API Python poll_for_event:断言“!xcb_xlib_threads_sequence_lost”失败
【发布时间】:2017-10-30 07:24:57
【问题描述】:

我正在尝试在虚拟机 (VB) 上运行的 Ubuntu 12.04 上从 https://github.com/Microsoft/Cognitive-Face-Python 运行 Face API 示例。当我选择要检测的图像时,它会发送一个请求并接收结果,但之后:

sample/util.py:176: wxPyDeprecationWarning: Call to deprecated item EmptyImage. Use :class:`Image` instead.
wx_image = wx.EmptyImage(pil_image.width, pil_image.height)
[xcb] Unknown sequence number while processing queue
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
python: ../../src/xcb_io.c:274: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.
Aborted (core dumped)`

我已经检测到它停止的地方:

   try:
        attributes = (
            'age,gender,headPose,smile,facialHair,glasses,emotion,hair,'
            'makeup,occlusion,accessories,blur,exposure,noise'
        )
        # the call
        res = util.CF.face.detect(path, False, False, attributes)
        faces = [model.Face(face, path) for face in res]

        # ... WON'T GET HERE ...

        self.face_list.SetItems(faces)
        util.draw_bitmap_rectangle(self.bitmap, faces)

        log_text = 'Response: Success. Detected {} face(s) in {}'.format(
            len(res), path)
        self.log.log(log_text)
        text = '{} face(s) has been detected.'.format(len(res))
        self.result.SetLabelText(text)
    except util.CF.CognitiveFaceException as exp:
        self.log.log('Response: {}. {}'.format(exp.code, exp.msg))

这个sn-p来自sample/view/panel_detection.py

【问题讨论】:

  • 我在 ubuntu VM (12.04) 上重现了该错误,我没有太多时间深入挖掘,但从外观上看,应用程序在 wxPython 的 API 上崩溃存在(即当我放置断点并检查我没有看到函数的对象时)所以我怀疑这个库的版本有问题。我下载了 2.9 BTW,这是示例告诉我们使用的版本

标签: python ubuntu-12.04 microsoft-cognitive


【解决方案1】:

我未能在 Windows 10 和 macOS 10.12.5 上使用 Python 2.7 和 wxPython 3.0.2.0 的最新版本代码重现您的错误。

错误不是直接从示例代码中报告的,而是在内部的某个地方。而wx.EmptyImage 不应该是错误的关键点。所以我怀疑这可能与环境有关。

请确保您使用的是最新版本的示例代码和相应的软件包。例如,3.0.2.0 用于 wxPython。 Ubuntu 12.04 太旧了,可能会受到过时的依赖关系的影响。

我不得不承认,我们在使其恢复兼容方面所做的努力有限,因此请确保一切都是最新的。如果有任何进一步的问题,请随时更新。

【讨论】:

  • 根据pypi.python.org/pypi/wxPython 最新版本是4.0.0a2,我有这个。
  • @Filipko wxPython 4.0+ 是支持 Python2 和 Python3 的下一代 wxPython。我尚未测试与此的兼容性,因为它仍处于 alpha 阶段。所以请继续使用最新的 3.0+ 版本。
  • @Xuan Hu,看我对OP的评论,错误是可重现的。
  • @Filipko 那么您能否在不同的环境中重试该示例。像一个真正的操作系统(不是虚拟机)也有最新版本(像 Ubuntu 16.04 LTS)。如果这不适用,请确保您的 wxpython 是最新版本,应该是 3.0.2.0。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-02-13
  • 1970-01-01
  • 2022-08-23
  • 2011-05-27
  • 1970-01-01
相关资源
最近更新 更多