python 2.7 - Confused approach to Pyinstaller with PyQt4 -


i have gui program built using python 2.7 , pyqt4. want convert standalone windows executable.

i went through docs pyinstaller-2.0 , tried several times think might on wrong approach.

here structure of program.

[resources] #contains images of icons

[hunspell] #contains program specific files

[stylesheets] #contains theme related files

resources.py

design.py

main.py

the first 3 folders containing necessary files program run. file main.py imports other 2 run properly. do go towards making perfect executable?

i tried following :

python pyinstaller.py -w main.py 

and got following warning file.

w: no module named _subprocess (conditional import subprocess) w: no module named pyqt4.qtopengl (top-level import pyqt4.qt) w: no module named pyqt4._qt (top-level import pyqt4.qtxml) w: no module named cl (delayed, conditional import aifc) w: no module named _sha (delayed, conditional import hashlib) w: no module named _winreg (top-level import mimetypes) w: no module named pyqt4._qt (top-level import pyqt4.qtnetwork) w: no module named org (top-level import pickle) w: no module named _sha512 (delayed, conditional import hashlib) w: no module named nt (delayed, conditional import __main__) w: no module named msvcrt (conditional import getpass) w: no module named pyqt4.qt3support (top-level import pyqt4.qt) w: no module named aes (delayed, conditional import archive) w: no module named _scproxy (conditional import urllib) w: no module named easydialogs (conditional import getpass) w: no module named pyqt4._qt (top-level import pyqt4.qtcore) w: no module named nt (top-level import ntpath) w: no module named org (top-level import copy) w: no module named _md5 (delayed, conditional import hashlib) w: no module named msvcrt (conditional import subprocess) w: no module named pyqt4._qt (top-level import pyqt4.qtsvg) w: no module named socks (top-level import ftplib) w: no module named pyqt4._qt (top-level import pyqt4.qtgui) w: no module named msvcrt (delayed import getpass) w: no module named cl (delayed import aifc) w: no module named pyqt4._qt (top-level import pyqt4.qtassistant) w: no module named _emx_link (conditional import os) w: no module named pyqt4._qt (top-level import pyqt4.qttest) w: no module named _sha256 (delayed, conditional import hashlib) w: no module named pyqt4.qtsql (top-level import pyqt4.qt) w: no module named pyqt4._qt (top-level import pyqt4.qt) w: no module named pyqt4._qt (top-level import pyqt4.qtwebkit) w: no module named pyqt4._qt (top-level import pyqt4) w: no module named rourl2path (conditional import urllib) w: no module named _winreg (delayed import urllib) w: no module named crypt (delayed, conditional import __main__) w: no module named aes (delayed, conditional import __main__) w: __all__ built strangely @ line 0 - dis (/usr/lib/python2.7/dis.pyc) w: delayed  exec statement detected @ line 0 - bdb (/usr/lib/python2.7/bdb.pyc) w: delayed  eval hack detected @ line 0 - bdb (/usr/lib/python2.7/bdb.pyc) w: delayed  eval hack detected @ line 0 - bdb (/usr/lib/python2.7/bdb.pyc) w: delayed  __import__ hack detected @ line 0 - optparse (/usr/lib/python2.7/optparse.pyc) w: delayed conditional __import__ hack detected @ line 0 - doctest (/usr/lib/python2.7/doctest.pyc) w: delayed  exec statement detected @ line 0 - doctest (/usr/lib/python2.7/doctest.pyc) w: delayed conditional __import__ hack detected @ line 0 - doctest (/usr/lib/python2.7/doctest.pyc) w: __all__ built strangely @ line 0 - regex (/usr/local/lib/python2.7/dist-packages/regex.pyc) w: __all__ built strangely @ line 0 - tokenize (/usr/lib/python2.7/tokenize.pyc) w: __all__ built strangely @ line 0 - tokenize (/usr/lib/python2.7/tokenize.pyc) w: delayed  __import__ hack detected @ line 0 - pickle (/usr/lib/python2.7/pickle.pyc) w: delayed  __import__ hack detected @ line 0 - pickle (/usr/lib/python2.7/pickle.pyc) w: delayed  __import__ hack detected @ line 0 - encodings (/usr/lib/python2.7/encodings/__init__.pyc) w: __all__ built strangely @ line 0 - hashlib (/usr/lib/python2.7/hashlib.pyc) w: delayed conditional eval hack detected @ line 0 - warnings (/usr/lib/python2.7/warnings.pyc) w: delayed conditional __import__ hack detected @ line 0 - warnings (/usr/lib/python2.7/warnings.pyc) w: delayed  __import__ hack detected @ line 0 - email (/usr/lib/python2.7/email/__init__.pyc) w: delayed  exec statement detected @ line 0 - pdb (/usr/lib/python2.7/pdb.pyc) w: delayed conditional eval hack detected @ line 0 - pdb (/usr/lib/python2.7/pdb.pyc) w: delayed  eval hack detected @ line 0 - pdb (/usr/lib/python2.7/pdb.pyc) w: delayed conditional eval hack detected @ line 0 - pdb (/usr/lib/python2.7/pdb.pyc) w: delayed  eval hack detected @ line 0 - pdb (/usr/lib/python2.7/pdb.pyc) w: delayed conditional exec statement detected @ line 0 - iu (/home/kuro/desktop/notepad (copy)/pyinstaller/loader/iu.pyc) w: delayed conditional exec statement detected @ line 0 - iu (/home/kuro/desktop/notepad (copy)/pyinstaller/loader/iu.pyc) w: __all__ built strangely @ line 0 - collections (/usr/lib/python2.7/collections.pyc) w: delayed  exec statement detected @ line 0 - collections (/usr/lib/python2.7/collections.pyc) w: delayed conditional __import__ hack detected @ line 0 - unittest.main (/usr/lib/python2.7/unittest/main.pyc) w: delayed conditional __import__ hack detected @ line 0 - unittest.loader (/usr/lib/python2.7/unittest/loader.pyc) w: delayed conditional __import__ hack detected @ line 0 - unittest.loader (/usr/lib/python2.7/unittest/loader.pyc) w: delayed  __import__ hack detected @ line 0 - unittest.loader (/usr/lib/python2.7/unittest/loader.pyc) w: __all__ built strangely @ line 0 - __future__ (/usr/lib/python2.7/__future__.pyc) w: delayed  eval hack detected @ line 0 - gettext (/usr/lib/python2.7/gettext.pyc) 

and terminal output follows

8 info: wrote /home/kuro/desktop/notepad (copy)/main/main.spec 25 info: upx not available. 645 info: checking analysis 645 info: building analysis because out00-analysis.toc non existent 645 info: running analysis out00-analysis.toc 716 info: analyzing /home/kuro/desktop/notepad (copy)/support/_pyi_bootstrap.py 1311 info: analyzing /home/kuro/desktop/notepad (copy)/pyinstaller/loader/archive.py 1377 info: analyzing /home/kuro/desktop/notepad (copy)/pyinstaller/loader/carchive.py 1419 info: analyzing /home/kuro/desktop/notepad (copy)/pyinstaller/loader/iu.py 1433 info: analyzing main.py 2116 info: hidden import 'encodings' has been found otherwise 2116 info: looking run-time hooks 2117 info: analyzing rthook /home/kuro/desktop/notepad (copy)/support/rthooks/pyi_rth_qt4plugins.py 2156 info: analyzing rthook /home/kuro/desktop/notepad (copy)/support/rthooks/pyi_rth_encodings.py 4514 info: looking python library libpython2.7.so objdump: section '.dynamic' mentioned in -j option, not found in input file 4744 info: warnings written /home/kuro/desktop/notepad (copy)/main/build/pyi.linux2/main/warnmain.txt 4753 info: checking pyz 4754 info: rebuilding out00-pyz.toc because out00-pyz.pyz missing 4754 info: building pyz out00-pyz.toc 6724 info: checking pkg 6724 info: rebuilding out00-pkg.toc because out00-pkg.pkg missing 6724 info: building pkg out00-pkg.pkg 6743 info: checking exe 6743 info: rebuilding out00-exe.toc because main missing 6743 info: building exe out00-exe.toc 6772 info: appending archive exe /home/kuro/desktop/notepad (copy)/main/build/pyi.linux2/main/main 6782 info: checking collect 6783 info: building collect out00-collect.toc 

i believe need edit .spec file include 3 folders data collection. these collected compiled executable , extracted out temp folder rest of python libraries , files.

to add folder add below under = analysis section:

a.datas += tree('/home/kuro/desktop/notepad/resources', prefix='resources') 

see solutions:

this spec file 1 of projects. includes version.txt exe version info, icon, , upx.

# -*- mode: python -*- = analysis(['cleanup.py'],              pathex=[''],              hiddenimports=[],              hookspath=none,              runtime_hooks=none) a.datas += tree('d:\\projects\\cleanup\\data', prefix='data') pyz = pyz(a.pure) exe = exe(pyz,           a.scripts,           a.binaries,           a.zipfiles,           a.datas,           name='cleanup.exe',           debug=false,           strip=none,           upx=true,           console=true , version='version.txt', icon='trash.ico') 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -