I
I
insomnia112018-10-27 19:04:54
Python
insomnia11, 2018-10-27 19:04:54

Encoding error when switching to exe pyinstaller, how to escape?

Hi all! Converting python script to exe using pyinstaller.
There was such an error, I tried to find the symbol, it did not work.
Tell me, please, what could be the problem?
Thought the problem was in this piece

f = open(str(fls) + ".txt", "w",encoding='utf-8')
                f.write(self.TextEdit.toPlainText())
                f.close()

C:\ry\GUI GMInd>pyinstaller.exe --onefile --windowed --icon=icon.ico GM2W.py
593 INFO: PyInstaller: 3.4
593 INFO: Python: 3.6.6
594 INFO: Platform: Windows-8.1- 6.3.9600-SP0
675 INFO: wrote C:\ry\GUI GMInd\icon.spec
678 INFO: UPX is not available.
Traceback (most recent call last):
File "C:\Python36-32\Scripts\pyinstaller-script.py", line 11, in
load_entry_point('PyInstaller==3.4', 'console_scripts', 'pyinstaller')()
File "c:\python36-32\lib\site-packages\PyInstaller\__main__.py", line 111, in
run
run_build(pyi_config, spec_file, **vars(args))
File "c:\python36-32\lib\ site-packages\PyInstaller\__main__.py", line 63,
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\python36-32\lib\site-packages\PyInstaller\building\build_main.py", li
ne 838, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'
))
File "c:\python36-32\lib\site-packages\PyInstaller\building\build_main.py" , li
ne 784, in build
exec(text, spec_namespace)
File "", line 17, in
File "c:\python36-32\lib\site-packages\PyInstaller\building\build_main.py", li
ne 189, in __init__
raise ValueError("script '%s' not found" % script)
ValueError: script 'C:\ry\GUI GMInd\GM2W.py' not found
C:\ry\GUI GMInd>pyinstaller.exe --onefile --windowed --icon=icon.ico GM2W.pyw
134 INFO: PyInstaller: 3.4
135 INFO: Python: 3.6.6
136 INFO: Platform: Windows-8.1- 6.3.9600-SP0
145 INFO: wrote C:\ry\GUI GMInd\icon.spec
148 INFO: UPX is not available.
151 INFO: Extending PYTHONPATH with paths
['C:\\ry\\GUI GMInd', 'C:\\ry\\GUI GMInd', 'C:\\ry\\GUI GMInd']
152 INFO: checking Analysis
153 INFO: Building Analysis because Analysis-00.toc is non existent
153 INFO: Initializing module dependency graph...
166 INFO: Initializing module graph hooks...
172 INFO: Analyzing base_library.zip ...
11289 INFO: running Analysis Analysis- 00.toc
11343 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of
final executable
required by c:\python36-32\python.exe
12604 INFO: Caching module hooks...
12619 INFO: Analyzing C:\ry\GUI GMInd\ icon.ico
Traceback (most recent call last):
File "C:\Python36-32\Scripts\pyinstaller-script.py", line 11, in
load_entry_point('PyInstaller==3.4', 'console_scripts', 'pyinstaller') ()
File "c:\python36-32\lib\site-packages\PyInstaller\__main__.py", line 111, in
run
run_build(pyi_config, spec_file, **vars(args))
File "c:\python36-32 \lib\site-packages\PyInstaller\__main__.py", line 63, in r
un_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\python36-32\lib\site-packages\PyInstaller\building\build_main.py", li
ne 838, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'
))
File "c:\python36-32\lib\site-packages\PyInstaller\building\build_main.py" , li
ne 784, in build
exec(text, spec_namespace)
File "", line 17, in
File "c:\python36-32\lib\site-packages\PyInstaller\building\build_main.py", li
ne 241, in __init__
self.__postinit__()
File "c:\python36-32\lib\site-packages\PyInstaller\building\datastruct.py", line
158,in
__postinit__self.assemble()
File "c:\python36-32\lib\site-packages\PyInstaller\building\build_main.py", line
443, in assemble
priority_scripts.append(self.graph.run_script(script))
File "c:\python36- 32\lib\site-packages\PyInstaller\depend\analysis.py", line 2
01, in run_script
self._top_script_node = super(PyiModuleGraph, self).run_script(pathname)
File "c:\python36-32\lib\site -packages\PyInstaller\lib\modulegraph\modulegraph
.py", line 1335, in run_script
contents = fp.read() + '\n'
File "c:\python36-32\lib\codecs.py", line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 87: invalid
continuation byte

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
insomnia11, 2018-10-28
@insomnia11

icon = app.ico , but icon=app.ico

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question