开发者

How can I use xml.sax module on an executable made with PyInstaller?

I want to have my application read a document using xml.sax.parse. Things work fine but开发者_如何学C when I move the executable to a Windows server 2008 machine things break down. I get an SAXReaderNotAvailable exception with "No parsers found" message.

The setup I'm using to build the executable is:

  • 64 bit windows 7
  • Python 2.7.2 32-bit
  • PyInstaller 1.5.1


SAX readers seems to be dynamically imported, so the static analysis can't detect them and they can't be embedded with application.

To correct this, you'll have to be explicit to force PyInstaller to import those hidden modules.

Try to add this to you .spec (thanks Velociraptors) file :

hiddenimports = ['xml.sax.drivers', 'xml.sax.drivers2']


The executable turned out to be fine. For some reason or the other there's wrong versions of the needed dlls in PATH and the executable ended up trying to use those.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜