Path not Found Errors why does it want files in my USER DIRECTORY on MacOS

81 views
Skip to first unread message

David Greenland

unread,
Jan 15, 2023, 6:41:10 AM1/15/23
to PyInstaller
Hi.

I have included the .spec file and a copy of the error log when running from the terminal.  I have set the path to where the app is and it still wants my included data files to be in my USER Folder and not use the files it has inside the resource folder.  if I add the missing files & folders to my USER Folder the app works in terminal mode but not in the .app file

I have tried may different way to resolve this problem but I am stumped.  I resolve the relative path with the resourcePath function below and it always get the correct detail.

def resourcePath(relativePath):
try:
basePath = sys.MEIPASS
except Exception:
basePath = os.path.abspath('.')
return os.path.join(basePath, relativePath)

SPEC  FILE:
# -*- mode: python ; coding: utf-8 -*-
from PyInstaller.utils.hooks import collect_all

datas = [('/Volumes/Mac 2TB/Work/Projects/DartDev/DartImages', './DartImages'), ('/Volumes/Mac 2TB/Work/Projects/DartDev/UI/getplayersV2.ui', 'UI'), ('/Volumes/Mac 2TB/Work/Projects/DartDev/UI/halvemRandomSinglesV1.ui', 'UI'), ('/Volumes/Mac 2TB/Work/Projects/DartDev/UI/halvemRandomSinglesV2.ui', 'UI'), ('/Volumes/Mac 2TB/Work/Projects/DartDev/UI/halvemRandomDoublesV1.ui', 'UI'), ('/Volumes/Mac 2TB/Work/Projects/DartDev/UI/halvemRandomDoublesV2.ui', 'UI'), ('/Volumes/Mac 2TB/Work/Projects/DartDev/UI/mainWindow.ui', 'UI'), ('/Volumes/Mac 2TB/Work/Projects/DartDev/UI/scoreBoard.ui', 'UI'), ('/Volumes/Mac 2TB/Work/Projects/DartDev/UI/scoreBoardCricketV2.ui', 'UI'), ('/Volumes/Mac 2TB/Work/Projects/DartDev/UI/scoreBoardx01.ui', 'UI'), ('/Volumes/Mac 2TB/Work/Projects/DartDev/UI/scoreCricketv1.ui', 'UI'), ('/Volumes/Mac 2TB/Work/Projects/DartDev/UI/scoreCricketv2.ui', 'UI'), ('/Volumes/Mac 2TB/Work/Projects/DartDev/UI/scoreSheetDoublesV1.ui', 'UI'), ('/Volumes/Mac 2TB/Work/Projects/DartDev/UI/scoreSheetDoublesV2.ui', 'UI'), ('/Volumes/Mac 2TB/Work/Projects/DartDev/UI/scoreSheetSinglesV1.ui', 'UI'), ('/Volumes/Mac 2TB/Work/Projects/DartDev/UI/scoreSheetSinglesV2.ui', 'UI'), ('/Volumes/Mac 2TB/Work/Projects/DartDev/UI/scoreSheetTreblesV1.ui', 'UI'), ('/Volumes/Mac 2TB/Work/Projects/DartDev/UI/scoreSheetTreblesV2.ui', 'UI'), ('/Volumes/Mac 2TB/Work/Projects/DartDev/UI/scoreX01v2.ui', 'UI'), ('/Volumes/Mac 2TB/Work/Projects/DartDev/UI/splashScreen.ui', 'UI'), ('/Volumes/Mac 2TB/Work/Projects/DartDev/playerfile.txt', '.')]
binaries = [('/Volumes/Mac 2TB/Work/Projects/DartDev/DartImages/darts2.png', '.')]
hiddenimports = []
tmp_ret = collect_all('screeninfo')
datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2]


block_cipher = None


a = Analysis(
    ['maingame.py'],
    pathex=['/Volumes/Mac 2TB/Work/Projects/DartDev'],
    binaries=binaries,
    datas=datas,
    hiddenimports=hiddenimports,
    hookspath=[],
    hooksconfig={},
    runtime_hooks=[],
    excludes=[],
    win_no_prefer_redirects=False,
    win_private_assemblies=False,
    cipher=block_cipher,
    noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)

exe = EXE(
    pyz,
    a.scripts,
    [],
    exclude_binaries=True,
    name='DartVader',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    console=False,
    disable_windowed_traceback=False,
    argv_emulation=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
    icon=['/Volumes/Mac 2TB/Work/Projects/DartDev/dart.icns'],
)
coll = COLLECT(
    exe,
    a.binaries,
    a.zipfiles,
    a.datas,
    strip=False,
    upx=True,
    upx_exclude=[],
    name='DartVader',
)
app = BUNDLE(
    coll,
    name='DartVader.app',
    icon='/Volumes/Mac 2TB/Work/Projects/DartDev/dart.icns',
    bundle_identifier=None,
)

Package Details one pyinstaller has completed.
Package Info from OneFile.png
Compile Errors.png

Any assistance appreciated

David Greenland

unread,
Jan 26, 2023, 4:32:10 AM1/26/23
to PyInstaller
Latest Update:

I found my issue in the file looking in my local folder for files, it now looks in the correct location, the file path is

'/Volumes/Mac 2TB/Work/Projects/DartDev/dist/DartVader/'  which is correct, I now have the 2 folder and their contents in the correct place in the dist folder. 

My spec file appears to be correct I even get the ICON on the app file:

# -*- mode: python ; coding: utf-8 -*-
from PyInstaller.utils.hooks import collect_all

datas = [('/Volumes/Mac 2TB/Work/Projects/DartDev/UI', ' UI'), ('/Volumes/Mac 2TB/Work/Projects/DartDev/playerfile.txt', '.'), ('/Volumes/Mac 2TB/Work/Projects/DartDev/DartImages', ' DartImages')]
binaries = []

However I now get the following error:

WADiverDave@192 ~ % /Volumes/Mac\ 2TB/Work/Projects/DartDev/dist/DartVader/DartVader ; exit;
/Volumes/Mac 2TB/Work/Projects/DartDev/dist/DartVader
/Volumes/Mac 2TB/Work/Projects/DartDev/dist/DartVader
Traceback (most recent call last):
  File "maingame.py", line 168, in <module>
  File "maingame.py", line 153, in main
  File "maingame.py", line 72, in __init__
  File "maingame.py", line 102, in setUpUI
  File "PyQt5/uic/__init__.py", line 238, in loadUi
  File "PyQt5/uic/Loader/loader.py", line 66, in loadUi
  File "PyQt5/uic/uiparser.py", line 1020, in parse
  File "xml/etree/ElementTree.py", line 1229, in parse
  File "xml/etree/ElementTree.py", line 569, in parse
FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Mac 2TB/Work/Projects/DartDev/dist/DartVader/UI/splashScreen.ui'
[86356] Failed to execute script 'maingame' due to unhandled exception: [Errno 2] No such file or directory: '/Volumes/Mac 2TB/Work/Projects/DartDev/dist/DartVader/UI/splashScreen.ui'

[86356] Traceback:
Traceback (most recent call last):
  File "maingame.py", line 168, in <module>
  File "maingame.py", line 153, in main
  File "maingame.py", line 72, in __init__
  File "maingame.py", line 102, in setUpUI
  File "PyQt5/uic/__init__.py", line 238, in loadUi
  File "PyQt5/uic/Loader/loader.py", line 66, in loadUi
  File "PyQt5/uic/uiparser.py", line 1020, in parse
  File "xml/etree/ElementTree.py", line 1229, in parse
  File "xml/etree/ElementTree.py", line 569, in parse
FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Mac 2TB/Work/Projects/DartDev/dist/DartVader/UI/splashScreen.ui'

My dist folder has the DartsVader folder and inside a UI folder and inside that there is the splashScreen.ui file - I just dont understand why it will now move forward.

Thanks for any assistance.
Reply all
Reply to author
Forward
0 new messages