«Исключение: ScrollView принимает только один виджет» после сборки с помощью PyInstller - PullRequest
0 голосов
/ 16 марта 2020

Мне нужна помощь. Я получаю исключение "Исключение: ScrollView принимает только один виджет" после создания приложения KIVY с PyInstaller. Если я запускаю его из IDE или вызываю основной из командной строки, он запускается без ошибок.

Это вывод консоли:

...
Traceback (most recent call last):
   File "src\main.py", line 115, in <module>
     main()
   File "src\main.py", line 108, in main
     globals.APP.run()
   File "site-packages\kivy\app.py", line 829, in run
   File "src\REFORM_App.py", line 63, in build
     return MyScreenManager()
   File "site-packages\kivy\uix\screenmanager.py", line 968, in __init__
   File "site-packages\kivy\uix\floatlayout.py", line 65, in __init__
   File "site-packages\kivy\uix\layout.py", line 76, in __init__
   File "site-packages\kivy\uix\widget.py", line 361, in __init__
   File "site-packages\kivy\uix\widget.py", line 469, in apply_class_lang_rules
   File "site-packages\kivy\lang\builder.py", line 538, in apply
   File "site-packages\kivy\lang\builder.py", line 657, in _apply_rule
   File "site-packages\kivy\uix\widget.py", line 469, in apply_class_lang_rules
   File "site-packages\kivy\lang\builder.py", line 538, in apply
   File "site-packages\kivy\lang\builder.py", line 659, in _apply_rule
   File "site-packages\kivy\lang\builder.py", line 657, in _apply_rule
   File "site-packages\kivy\uix\widget.py", line 469, in apply_class_lang_rules
   File "site-packages\kivy\lang\builder.py", line 538, in apply
   File "site-packages\kivy\lang\builder.py", line 655, in _apply_rule
   File "site-packages\kivy\uix\recycleview\__init__.py", line 466, in add_widget
   File "site-packages\kivy\uix\scrollview.py", line 1094, in add_widget
 Exception: ScrollView accept only one widget
[98108] Failed to execute script main
[98108] LOADER: OK.
[98108] LOADER: Cleaning up Python interpreter.

Я не могу понять, где проблема, потому что перед сборкой приложения оно работает, как и ожидалось.
Я на Win 10 и Мой spe c файл:

# -*- mode: python ; coding: utf-8 -*-

from kivy_deps import sdl2, glew, angle

block_cipher = None

added_files = [
  (".\\src\\data\\fonts", "data\\fonts"),
  (".\\src\\data\\pics", "data\\pics"),
  (".\\src\\data\\ressources", "data\\ressources"),
  (".\\src\\data\\sqlite-tools", "data\\sqlite-tools"),
  (".\\src\\data\\Templates", "data\\Templates")
]

hid_imports = [
  "mainscreen gui.screens.mainscreen",
  "gui.guiutils.multiselectspinner",
  "gui.screens.helpscreen",
  "gui.screens.editscreen",
  "gui.screens.gentextscreen",
  "gui.guiutils.tooltipspinner",
  "globals",
  "gui.screens.elements.datatable",
  "gui.screens.elements.row",
  "gui.screens.elements.searchbar",
  "gui.screens.elements.sidebarmain",
  "gui.screens.elements.statusbar"
]

a = Analysis(['src\\main.py'],
             pathex=['C:\\Users\\bondarenko\\Desktop\\pywrap'],
             binaries=[],
             # datas=[],
             datas=added_files,
             hiddenimports=hid_imports,
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             noarchive=False)

# exclusion list
from fnmatch import fnmatch
from os.path import join
exclusion_patterns = (
    join("kivy_install", "data", "logo*"),
    # join("kivy_install", "data", "fonts", "DejaVuSans*"),
    join("kivy_install", "modules*"),
    join("Include*"),
    join("sdl2-config"),
    # Filter app directory
    join("personal*"),
    join("sign-apk*"),
    join(".idea*"),
    join("test*"),
    join("gui", "test*")
)

def can_exclude(fn):
    for pat in exclusion_patterns:
        if fnmatch(fn, pat):
            return True

a.datas += [x for x in a.datas if not can_exclude(x[0])]
a.binaries = [x for x in a.binaries if not can_exclude(x[0])]
# Filter app directory
appfolder = [x for x in Tree('.\\src\\', excludes=['*.py','*.pyc']) if not can_exclude(x[0])]


pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)

exe = EXE(pyz,
          a.scripts,
          [],
          exclude_binaries=True,
          name='almgen',
          debug=True,
          bootloader_ignore_signals=False,
          strip=False,
          upx=True,
          console=True,
          icon=".\\src\\data\\pics\\reform_exe_icon.ico")

coll = COLLECT(exe, appfolder,
              # Tree('.\\src\\'), 
              # Tree(".\\src\\gui"), Tree(".\\src\\gui\\screens\\"),
              # Tree(".\\src\\gui\\screens\\\elements\\"),

               a.binaries,
               a.zipfiles,
               a.datas,
               *[Tree(p) for p in (sdl2.dep_bins + angle.dep_bins)],
               strip=False,
               upx=True,
               upx_exclude=[],
               name='almgen')

Дайте мне знать, какая дополнительная информация вам нужна.

...