missing reference to attribute ?

14 views
Skip to first unread message

wimv...@gmail.com

unread,
Aug 9, 2021, 10:42:28 AM8/9/21
to PyInstaller
I have a Python 3.9 / Kivy 2.0.0 app running perfectly well on Windows10 within PyCharm. 
When building the exe using PyInstaller (4.5.1) the app builds, the exe starts but crashes at a certain point.

Why isn't PyInstaller able to reference data_table.py correctly?

The exception is: 

  File "appguides.py", line 72, in <module>
  File "kivy\lang\builder.py", line 373, in load_string
  File "kivy\lang\parser.py", line 402, in __init__
  File "kivy\lang\parser.py", line 508, in parse
  File "kivy\lang\parser.py", line 477, in execute_directives
AttributeError: module 'pmuix' has no attribute 'data_table'

At line 72 in appguides.py I have:

from appguideskv import style, APPGVersionItem
Builder.load_string(style)

and in appguideskv I have the following import statements:

#:import Factory kivy.factory.Factory
#:import dp kivy.metrics.dp
#:import PMDataTable pmuix.data_table
#:import PMTextField pmuix.textfields
#:import PMIconButton pmuix.iconbutton

The project structure is as follows:
myapp
    > folder: pmuix
           file: __init__.py
           file: data_table.py
           file: textfields.py
           file: iconbutoon.py



this is the spec file:
# -*- mode: python -*-

import os
import websocket
from os.path import join, dirname, basename
from PyInstaller.compat import modname_tkinter

from kivy import kivy_data_dir
from kivy_deps import sdl2, glew
from kivy.tools.packaging import pyinstaller_hooks as hooks

block_cipher = None
kivy_deps_all = hooks.get_deps_all()
kivy_factory_modules = hooks.get_factory_modules()
websocket_lib_path = dirname(websocket.__file__)
websocket_cacert_file_path = join(websocket_lib_path, 'cacert.pem')

analysis_data = []

datas = [#(join('.', '*.kv'), '.'),
    (join('fonts', '*.ttf'), 'fonts')]

# list of modules to exclude from analysis
excludes = ['twisted', 'pygments']

# list of hiddenimports
hiddenimports = kivy_deps_all['hiddenimports'] + ['html.parser'] + ['backend_kivy'] + kivy_factory_modules + ['pandas._libs.tslibs.timedeltas']

# binary data
sdl2_bin_tocs = [Tree(p) for p in sdl2.dep_bins]
glew_bin_tocs = [Tree(p) for p in glew.dep_bins]
bin_tocs = sdl2_bin_tocs + glew_bin_tocs

# assets
kivy_assets_toc = Tree(kivy_data_dir, prefix=join('kivy_install', 'data'))
source_assets_toc = Tree('images', prefix='images')
assets_toc = [kivy_assets_toc, source_assets_toc]

tocs = bin_tocs + assets_toc


a = Analysis(['ngcmain.py'],
             pathex=[os.getcwd(),'~/kivy/garden/matplotlib'],
             binaries=None,
             datas=datas,
             hiddenimports=hiddenimports,
             hookspath=[],
             runtime_hooks=[],
             excludes=excludes,
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher)
      
pyz = PYZ(a.pure, a.zipped_data,  cipher=block_cipher)

exe1 = EXE(pyz,
          a.scripts,
          name='ngcreator',
          exclude_binaries=True,
          icon=join('images', 'ngcreator.ico'),
          debug=False,
          strip=False,
          upx=True,
          console=False)
 


Allen beantwoorden
Auteur beantwoorden
Doorsturen

wimv...@gmail.com

unread,
Aug 10, 2021, 2:52:16 AM8/10/21
to PyInstaller
The solution can be found at: https://groups.google.com/g/kivy-users/c/8J5-8jqy-io/m/7AG23mMTBQAJ


Op maandag 9 augustus 2021 om 16:42:28 UTC+2 schreef wimv...@gmail.com:
Reply all
Reply to author
Forward
0 new messages