E
E
Eugene2020-06-17 08:25:52
Python
Eugene, 2020-06-17 08:25:52

Why do errors appear after compiling the .EXE, does everything work through the .py file?

Before compiling the file in .exe, everything works as it should, after all the resources are packed through pyinstaller into one file, errors appear in the console:

Exception in Tkinter callback
Traceback (most recent call last):
  File "tkinter\__init__.py", line 1699, in __call__
  File "Label for bach scan v4.py", line 64, in get_bach
  File "Label for bach scan v4.py", line 46, in Ean
  File "site-packages\barcode\base.py", line 68, in save
  File "site-packages\barcode\codex.py", line 261, in render
  File "site-packages\barcode\base.py", line 111, in render
  File "site-packages\barcode\writer.py", line 226, in render
  File "site-packages\barcode\writer.py", line 356, in _paint_text
  File "site-packages\PIL\ImageFont.py", line 648, in truetype
  File "site-packages\PIL\ImageFont.py", line 645, in freetype
  File "site-packages\PIL\ImageFont.py", line 194, in __init__
OSError: cannot open resource

The function where the above errors occur:
def Ean():
    EAN = barcode.get_barcode_class('Code128')
    ean = EAN(str(leather_field.get()), writer=ImageWriter())
    ean.save(tempfile.gettempdir() + "\\barcode", {"module_width":0.25, "module_height":5, "font_size": 10, "text_distance": 3, "quiet_zone": 3})

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
Eugene, 2020-06-17
@Eisenshof

Stel as not recommended but it works.
Replaced font variable in \Lib\site-packages\barcode\writer.py

#FONT = os.path.join(PATH, 'DejaVuSansMono.ttf')
FONT = "arial.ttf"

H
HemulGM, 2020-06-17
@HemulGM

Judging by the error, not all resources were packed

M
Maxim Siomin, 2020-06-17
@MaxSiominDev

It was the same crap, read this site He helped to do everything

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question