SpanishBoy
SpanishBoy

Reputation: 2225

Support QtCore library path in PyInstaller

I just found a way to support all image formats in QtCore like below

from PySide imnport QtCore...

QtCore.QCoreApplication.addLibraryPath(os.path.join(os.path.dirname(QtCore.__file__), "plugins"))

However, when I build the application with PyInstaller under Windows I still having issue with suporting JPEGs/BPMs... looks like this path was not been added to compiled application.

How can I add it?

Upvotes: 0

Views: 454

Answers (1)

SpanishBoy
SpanishBoy

Reputation: 2225

Based on simple ideas from http://qt-project.org/wiki/Packaging_PySide_applications_on_Windows

I added to my app.spec file following code:

from PySide import QtCore

plugins=os.path.join(os.path.dirname(QtCore.__file__), "plugins\\imageformats")
static_files += Tree(plugins, 'plugins\\imageformats')

and to app.py(main form):

QtCore.QCoreApplication.addLibraryPath(os.path.join(os.path.dirname(QtCore.__file__), "plugins"))

Everything is working!

Upvotes: 1

Related Questions