Импорты в моем главном файле main.py:
from PyQt6.QtWidgets import QApplication
from window_content import MainWindow
window_content.py
from PyQt6.QtWidgets import QMainWindow, QPushButton, QLabel, QVBoxLayout, QWidget, QHBoxLayout
from Config import Config
from MyWidgets import FileNamesContainer, InfoPanel, FoldersWidget
from functions import copy_files, move_files, read_file_data
functions.py
import os
import shutil
from os import path, makedirs
import re
MyWidgets.py
from PyQt6.QtWidgets import QPushButton, QComboBox, QTextEdit, QLabel, QWidget, QVBoxLayout, QDialog
from PyQt6.QtCore import Qt
import re
from os import path
setup.py
from setuptools import setup
APP_NAME = "FastPhCopier"
APP = ['main.py']
DATA_FILES = [("files", ["files/config.ini", "files/instruction.txt"])]
OPTIONS = {"packages": ["PyQt6", "PyQt6-sip", "PyQt6.QtWidgets", "PyQt6-Qt6"], "iconfile": "icons/icon.icns", "argv_emulation": True}
setup(
app=APP,
name=APP_NAME,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
В терминале пишу команду
python3 setup.py py2app -A
Запускаю сформированное приложение, а оно вылетает
Пробовала запускать напрямую через исполняемый файл
dist/FastPhCopier.app/Contents/MacOS/FastPhCopier
Выскакивала ошибка
/Users/liana/Downloads/ph_selecter/dist/FastPhCopier.app/Contents/Resources/__boot__.py:86: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses
import imp
Traceback (most recent call last):
File "/Users/liana/Downloads/ph_selecter/dist/FastPhCopier.app/Contents/Resources/__boot__.py", line 495, in <module>
_run()
File "/Users/liana/Downloads/ph_selecter/dist/FastPhCopier.app/Contents/Resources/__boot__.py", line 489, in _run
exec(compile(source, script, "exec"), globals(), globals())
File "/Users/liana/Downloads/ph_selecter/main.py", line 1, in <module>
from PyQt6.QtWidgets import QApplication
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 674, in _load_unlocked
File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
File "/Users/liana/Downloads/ph_selecter/dist/FastPhCopier.app/Contents/Resources/__boot__.py", line 92, in load_module
return imp.load_module(
^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/imp.py", line 245, in load_module
return load_package(name, filename)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/imp.py", line 217, in load_package
return _load(spec)
^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 720, in _load
AttributeError: 'NoneType' object has no attribute 'name'
2023-02-27 21:48:25.875 FastPhCopier[91876:10968356] Launch error
2023-02-27 21:48:25.875 FastPhCopier[91876:10968356] Launch error
See the py2app website for debugging launch issues
liana@192 ph_selecter %
При этом на винде проблем никаких с билдом не было