Pyinstaller and import issue with wx.lib.pubsub

喜你入骨 提交于 2019-12-01 09:25:24
8006 WARNING: Hidden import "wx.lib.pubsub.core.publisher" not found!
8008 WARNING: Hidden import "wx.lib.pubsub.core.listenerimpl" not found!
8009 WARNING: Hidden import "wx.lib.pubsub.core.publishermixin" not found!
8009 WARNING: Hidden import "wx.lib.pubsub.core.datamsg" not found!
8009 WARNING: Hidden import "wx.lib.pubsub.core.topicargspecimpl" not found!
8009 WARNING: Hidden import "wx.lib.pubsub.core.topicmgrimpl" not found!

These modules are missing in core, move them back there in case you have misplaced the modules.

Stefano

Apparently the import of those modules is done in the subfolder kwargs, but those files actually need to be placed in the root folder.

So I just copied those files from

Lib\site-packages\wx-3.0-msw\wx\lib\pubsub\core\kwargs

to

Lib\site-packages\wx-3.0-msw\wx\lib\pubsub\core

and now IT WORKS!

I ran into the same problem, which is still present after the release of pyinstaller 3.4. This is a known issue when using any of wx.lib.pubsub, PyPubSub, or pypubsub with pyinstaller. See https://github.com/pyinstaller/pyinstaller/issues/1530 ; apparently imports are handled in a way that is tricky to work around. PyPubSub and pypubsub are forks of the same code base, and will have the same problem. If do not want to hack the libs of the wx distribution with every release, your options include:

  • Switch to PyDispatcher, blinker, or another simpler pubsub library
  • Modify PyPubSub so that it loads modules in a way that is compatible with pyinstaller, and submit the PR back to the project

The path of least resistance seems to be to find a different pubsub library. I switched to blinker, which is minimal and good for smaller projects.

Another tip: be aware that with pyinstaller there is usually one version combination that is stable, and this varies per-platform.

I ran into this problem recently and I found another solution that worked for me. I replaced from wx.lib.pubsub import pub with from pubsub import pub. You may have do a pip install pypubsub to get the needed package. You can find more information here: https://github.com/schollii/pypubsub/issues/7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!