python - PyInstaller error with PySide -


i have been playing pyinstaller on windows 7 (64 bit). using pyinstaller 3.1.1 python 2.7.6. created app creates simple pyside gui , generated dist folder executable command:

> c:\python27\scripts\pyinstaller.exe .\hellowidget.spec 

this spec file looks like:

# -*- mode: python -*-  block_cipher = none   = analysis(['hellowidget.py'],              pathex=['c:\\users\\spearsc\\documents\\python_projects\\helloworldgui'],              binaries=none,              datas=[('.\\mainwindow.ui', '.')],              hiddenimports=[],              hookspath=[],              runtime_hooks=[],              excludes=[],              win_no_prefer_redirects=false,              win_private_assemblies=false,              cipher=block_cipher) pyz = pyz(a.pure, a.zipped_data,              cipher=block_cipher) exe = exe(pyz,           a.scripts,           exclude_binaries=true,           name='hellowidget',           debug=false,           strip=false,           upx=true,           console=true ) coll = collect(exe,                a.binaries,                a.zipfiles,                a.datas,                strip=false,                upx=true,                name='hellowidget') 

i wanted use spec file, .ui file bundled along else. however, when run executable, error:

> .\hellowidget.exe traceback (most recent call last):   file "<string>", line 41, in <module>   file "c:\users\spearsc\appdata\local\temp\pip-build-djws3k\pyinstaller\pyinstaller\loader\pyimod03_importers.py", line  389, in load_module   file "pyside-1.2.2\pyside\__init__.py", line 55, in <module>   file "pyside-1.2.2\pyside\__init__.py", line 11, in _setupqtdirectories   file "pyside-1.2.2\pyside\_utils.py", line 87, in get_pyside_dir   file "pyside-1.2.2\pyside\_utils.py", line 83, in _get_win32_case_sensitive_name   file "pyside-1.2.2\pyside\_utils.py", line 58, in _get_win32_short_name windowserror: [error 2] system cannot find file specified. pyi_rth_qt4plugins returned -1 

what confusing me when in dist folder, see compiled pyside , qt files:

    directory: c:\users\spearsc\documents\python_projects\helloworldgui\dist\hellowidget   mode                lastwritetime     length name ----                -------------     ------ ---- -a---         5/23/2016   4:45 pm      80896 bz2.pyd -a---         5/24/2016   5:20 pm     795278 hellowidget.exe -a---         5/24/2016   5:20 pm       1019 hellowidget.exe.manifest -a---         5/24/2016   4:42 pm       4102 mainwindow.ui -a---         5/24/2016   5:20 pm       1052 microsoft.vc90.crt.manifest -a---         5/23/2016   4:45 pm     245760 msvcm90.dll -a---         5/23/2016   4:45 pm     853328 msvcp90.dll -a---         5/23/2016   4:45 pm     641360 msvcr90.dll -a---         5/24/2016   4:43 pm     248320 pyside-python2.7.dll -a---         5/24/2016   4:43 pm    3063808 pyside.qtcore.pyd -a---         5/24/2016   4:43 pm   12750848 pyside.qtgui.pyd -a---         5/24/2016   4:43 pm    1095168 pyside.qtnetwork.pyd -a---         5/24/2016   4:43 pm    1052672 pyside.qtuitools.pyd -a---         5/23/2016   4:45 pm    3004928 python27.dll -a---         5/24/2016   4:43 pm    3469824 qtcore4.dll -a---         5/24/2016   4:43 pm   11679744 qtgui4.dll -a---         5/24/2016   4:43 pm    1473536 qtnetwork4.dll -a---         5/23/2016   4:45 pm      10752 select.pyd -a---         5/24/2016   4:43 pm     330752 shiboken-python2.7.dll -a---         5/23/2016   4:45 pm     689664 unicodedata.pyd -a---         5/24/2016   4:43 pm     111616 _ctypes.pyd -a---         5/23/2016   4:45 pm     474624 _hashlib.pyd 

any thoughts? can not trust see in dist folder?

5/25/16:

well, interesting. put print statement in _get_win32_short_name function.

def _get_win32_short_name(s):     """ returns short name """     print s     buf_size = max_path     in range(2):         buf = create_unicode_buffer(u('\0') * (buf_size + 1))         r = getshortpathnamew(u(s), buf, buf_size)         if r == 0:             raise winerror()         if r < buf_size:             if py_2:                 return buf.value.encode(sys.getfilesystemencoding())             return buf.value         buf_size = r     raise winerror() 

here result got after built new executable.

> .\hellowidget.exe c:\users\spearsc\docume~1\python~1\hellow~1\dist\hellow~1\pyside traceback (most recent call last):   file "<string>", line 41, in <module>   file "c:\users\spearsc\appdata\local\temp\pip-build-djws3k\pyinstaller\pyinstaller\loader\pyimod03_importers.py", line  389, in load_module   file "pyside-1.2.2\pyside\__init__.py", line 55, in <module>   file "pyside-1.2.2\pyside\__init__.py", line 11, in _setupqtdirectories   file "pyside-1.2.2\pyside\_utils.py", line 88, in get_pyside_dir   file "pyside-1.2.2\pyside\_utils.py", line 84, in _get_win32_case_sensitive_name   file "pyside-1.2.2\pyside\_utils.py", line 59, in _get_win32_short_name windowserror: [error 2] system cannot find file specified. pyi_rth_qt4plugins returned -1 

the directory not exist. ideas on how around that?

the trick add empty pyside folder in dist folder.

    directory: c:\users\spearsc\documents\python_projects\helloworldgui\dist\hellowidget   mode                lastwritetime     length name ----                -------------     ------ ---- d----         5/25/2016   2:46 pm            pyside -a---         5/23/2016   4:45 pm      80896 bz2.pyd -a---         5/25/2016   2:46 pm     795278 hellowidget.exe -a---         5/25/2016   2:46 pm       1019 hellowidget.exe.manifest -a---         5/24/2016   4:42 pm       4102 mainwindow.ui -a---         5/25/2016   2:46 pm       1052 microsoft.vc90.crt.manifest -a---         5/23/2016   4:45 pm     245760 msvcm90.dll -a---         5/23/2016   4:45 pm     853328 msvcp90.dll -a---         5/23/2016   4:45 pm     641360 msvcr90.dll -a---         5/24/2016   4:43 pm     248320 pyside-python2.7.dll -a---         5/24/2016   4:43 pm    3063808 pyside.qtcore.pyd -a---         5/24/2016   4:43 pm   12750848 pyside.qtgui.pyd -a---         5/24/2016   4:43 pm    1095168 pyside.qtnetwork.pyd -a---         5/24/2016   4:43 pm    1052672 pyside.qtuitools.pyd -a---         5/25/2016   2:46 pm     542208 pyside.qtxml.pyd -a---         5/23/2016   4:45 pm    3004928 python27.dll -a---         5/24/2016   4:43 pm    3469824 qtcore4.dll -a---         5/24/2016   4:43 pm   11679744 qtgui4.dll -a---         5/24/2016   4:43 pm    1473536 qtnetwork4.dll -a---         5/25/2016   2:46 pm     506368 qtxml4.dll -a---         5/23/2016   4:45 pm      10752 select.pyd -a---         5/24/2016   4:43 pm     330752 shiboken-python2.7.dll -a---         5/23/2016   4:45 pm     689664 unicodedata.pyd -a---         5/24/2016   4:43 pm     111616 _ctypes.pyd -a---         5/23/2016   4:45 pm     474624 _hashlib.pyd 

after did ran executable , got import error pyside.qtxml, generated new spec file , modified it.

# -*- mode: python -*-  block_cipher = none   = analysis(['hellowidget.py'],              pathex=['c:\\users\\spearsc\\documents\\python_projects\\helloworldgui'],              binaries=none,              datas=[('.\mainwindow.ui', '.')],              hiddenimports=['pyside.qtxml'],              hookspath=[],              runtime_hooks=[],              excludes=[],              win_no_prefer_redirects=false,              win_private_assemblies=false,              cipher=block_cipher) pyz = pyz(a.pure, a.zipped_data,              cipher=block_cipher) exe = exe(pyz,           a.scripts,           exclude_binaries=true,           name='hellowidget',           debug=false,           strip=false,           upx=true,           console=true ) coll = collect(exe,                a.binaries,                a.zipfiles,                a.datas,                strip=false,                upx=true,                name='hellowidget') 

i used spec file create executable again. added empty pyside dist folder, , worked!


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -