Bonjour,

J'ai récemment fait un script pour comparer un fichier Shapefile (.shp) avec un csv. Si jamais il y a une erreur, cela ressort dans un fichier excel (au niveau de la racine du fichier Shapefile). Afin de pouvoir faciliter l'utilisation des personnes, avec lesquelles je voulais partager, j'ai créé une interface assez basique avec PyQt5.

Quand je le lance sur mon Jupyter Notebook, tout fonctionne bien. J'arrive aussi à le transformer en .exe à l'aide de cx_Freeze. Néanmoins, voulant un single-file executable. J'ai décidé de passer par PyInstaller. Néanmoins à chaque fois, je le lance et que j'essaie d'ouvrir mon exe, j'ai cette magnifique fenêtre que s'ouvre :

Nom : Capture.PNG
Affichages : 2395
Taille : 10,0 Ko

Ci-dessous, vous retrouverez ce que le cmd me répond quand je rentre la commande pyinstaller --onefile --windowed CompareCSVSHP.py"

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
C:\Users\x-trm\Desktop>pyinstaller --onefile --windowed CompareMediapost.py
83 INFO: PyInstaller: 3.5
83 INFO: Python: 3.6.6
83 INFO: Platform: Windows-10-10.0.17134-SP0
85 INFO: wrote C:\Users\x-trm\Desktop\CompareMediapost.spec
89 INFO: UPX is not available.
Traceback (most recent call last):
  File "c:\users\x-trm\downloads\wpy-3662\python-3.6.6.amd64\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\x-trm\downloads\wpy-3662\python-3.6.6.amd64\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\x-trm\Downloads\WPy-3662\python-3.6.6.amd64\Scripts\pyinstaller.exe\__main__.py", line 9, in <module>
  File "c:\users\x-trm\downloads\wpy-3662\python-3.6.6.amd64\lib\site-packages\PyInstaller\__main__.py", line 111, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "c:\users\x-trm\downloads\wpy-3662\python-3.6.6.amd64\lib\site-packages\PyInstaller\__main__.py", line 63, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "c:\users\x-trm\downloads\wpy-3662\python-3.6.6.amd64\lib\site-packages\PyInstaller\building\build_main.py", line 844, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "c:\users\x-trm\downloads\wpy-3662\python-3.6.6.amd64\lib\site-packages\PyInstaller\building\build_main.py", line 791, in build
    exec(code, spec_namespace)
  File "C:\Users\x-trm\Desktop\CompareMediapost.spec", line 17, in <module>
    noarchive=False)
  File "c:\users\x-trm\downloads\wpy-3662\python-3.6.6.amd64\lib\site-packages\PyInstaller\building\build_main.py", line 190, in __init__
    raise ValueError("script '%s' not found" % script)
ValueError: script 'C:\Users\x-trm\Desktop\CompareMediapost.py' not found
 
C:\Users\x-trm\Desktop>pyinstaller --onefile --windowed CompareCSVSHP.py
90 INFO: PyInstaller: 3.5
90 INFO: Python: 3.6.6
92 INFO: Platform: Windows-10-10.0.17134-SP0
97 INFO: wrote C:\Users\x-trm\Desktop\CompareCSVSHP.spec
100 INFO: UPX is not available.
106 INFO: Extending PYTHONPATH with paths
['C:\\Users\\x-trm\\Desktop', 'C:\\Users\\x-trm\\Desktop']
106 INFO: checking Analysis
107 INFO: Building Analysis because Analysis-00.toc is non existent
108 INFO: Initializing module dependency graph...
118 INFO: Initializing module graph hooks...
124 INFO: Analyzing base_library.zip ...
7392 INFO: running Analysis Analysis-00.toc
7420 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by c:\users\x-trm\downloads\wpy-3662\python-3.6.6.amd64\python.exe
10758 INFO: Caching module hooks...
10776 INFO: Analyzing C:\Users\x-trm\Desktop\CompareCSVSHP.py
14995 INFO: Processing pre-find module path hook   distutils
15626 INFO: Processing pre-find module path hook   site
15640 INFO: site: retargeting to fake-dir 'c:\\users\\x-trm\\downloads\\wpy-3662\\python-3.6.6.amd64\\lib\\site-packages\\PyInstaller\\fake-modules'
21301 INFO: Processing pre-safe import module hook   setuptools.extern.six.moves
30185 INFO: Processing pre-safe import module hook   six.moves
37141 INFO: Loading module hooks...
37141 INFO: Loading module hook "hook-distutils.py"...
37146 INFO: Loading module hook "hook-encodings.py"...
37260 INFO: Loading module hook "hook-lib2to3.py"...
37273 INFO: Loading module hook "hook-numpy.core.py"...
38843 INFO: Loading module hook "hook-numpy.py"...
38844 INFO: Loading module hook "hook-osgeo.py"...
38910 INFO: Loading module hook "hook-pkg_resources.py"...
40205 INFO: Processing pre-safe import module hook   win32com
41015 INFO: Loading module hook "hook-pycparser.py"...
41213 INFO: Loading module hook "hook-pydoc.py"...
41214 INFO: Loading module hook "hook-PyQt5.py"...
41921 INFO: Loading module hook "hook-PyQt5.QtCore.py"...
43357 INFO: Loading module hook "hook-PyQt5.QtGui.py"...
45474 INFO: Loading module hook "hook-PyQt5.QtWidgets.py"...
47276 INFO: Loading module hook "hook-pytest.py"...
48675 INFO: Loading module hook "hook-pythoncom.py"...
49603 INFO: Loading module hook "hook-pywintypes.py"...
50525 INFO: Loading module hook "hook-scipy.py"...
50530 INFO: Loading module hook "hook-setuptools.py"...
51931 INFO: Loading module hook "hook-sysconfig.py"...
51933 INFO: Loading module hook "hook-win32com.py"...
53069 INFO: Loading module hook "hook-xml.dom.domreg.py"...
53071 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
53073 INFO: Loading module hook "hook-xml.py"...
53126 INFO: Looking for ctypes DLLs
53178 INFO: Analyzing run-time hooks ...
53186 INFO: Including run-time hook 'pyi_rth_osgeo.py'
53189 INFO: Including run-time hook 'pyi_rth_pkgres.py'
53191 INFO: Including run-time hook 'pyi_rth_win32comgenpy.py'
53194 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
53199 INFO: Including run-time hook 'pyi_rth_pyqt5.py'
53219 INFO: Looking for dynamic libraries
93683 INFO: Looking for eggs
93683 INFO: Using Python library c:\users\x-trm\downloads\wpy-3662\python-3.6.6.amd64\python36.dll
93685 INFO: Found binding redirects:
[]
93700 INFO: Warnings written to C:\Users\x-trm\Desktop\build\CompareCSVSHP\warn-CompareCSVSHP.txt
93895 INFO: Graph cross-reference written to C:\Users\x-trm\Desktop\build\CompareCSVSHP\xref-CompareCSVSHP.html
93942 INFO: checking PYZ
93942 INFO: Building PYZ because PYZ-00.toc is non existent
93944 INFO: Building PYZ (ZlibArchive) C:\Users\x-trm\Desktop\build\CompareCSVSHP\PYZ-00.pyz
95721 INFO: Building PYZ (ZlibArchive) C:\Users\x-trm\Desktop\build\CompareCSVSHP\PYZ-00.pyz completed successfully.
95765 INFO: checking PKG
95765 INFO: Building PKG because PKG-00.toc is non existent
95767 INFO: Building PKG (CArchive) PKG-00.pkg
96236 WARNING: One binary added with two internal names.
96237 WARNING: ('libGLESv2.dll',
 'C:\\users\\x-trm\\downloads\\wpy-3662\\python-3.6.6.amd64\\lib\\site-packages\\PyQt5\\Qt\\bin\\libGLESv2.dll',
 'BINARY')
96239 WARNING: was placed previously at
96242 WARNING: ('PyQt5\\Qt\\bin\\libGLESv2.dll',
 'C:\\users\\x-trm\\downloads\\wpy-3662\\python-3.6.6.amd64\\lib\\site-packages\\PyQt5\\Qt\\bin\\libGLESv2.dll',
 'BINARY')
125423 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
125433 INFO: Bootloader c:\users\x-trm\downloads\wpy-3662\python-3.6.6.amd64\lib\site-packages\PyInstaller\bootloader\Windows-64bit\runw.exe
125433 INFO: checking EXE
125435 INFO: Building EXE because EXE-00.toc is non existent
125435 INFO: Building EXE from EXE-00.toc
125440 INFO: Appending archive to EXE C:\Users\x-trm\Desktop\dist\CompareCSVSHP.exe
125520 INFO: Building EXE from EXE-00.toc completed successfully.
Ci-dessous, les librairies que j'utilise et leur version (avec un Python 3.6.6) :

PyQt - 5.13.0
PyInstaller - 3.5
XLWT - 1.3.0
GDAL - 2.4.1
NUMPY - 1.17
CSV, OS, SYS, TEMPFILE

Avez-vous déjà été confronté à ce problème et pouvez-vous m'aider à le résoudre ?

Merci pour votre réponse.