开发者

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

开发者 https://www.devze.com 2023-03-31 22:08 出处:网络
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 SAXReaderN

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

精彩评论

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