Skip to content

Commit

Permalink
debug pyinstaller resources
Browse files Browse the repository at this point in the history
  • Loading branch information
Henri Wahl committed Sep 2, 2024
1 parent 53566e1 commit 92fd4e4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Nagstamon/Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1062,11 +1062,17 @@ def __init__(self, **kwds):
executable_dir = os.path.join(os.sep.join(sys.executable.split(os.sep)[:-1]))
if os.path.exists(os.path.normcase(os.sep.join((executable_dir, "resources")))):
RESOURCES = os.path.normcase(os.sep.join((executable_dir, "resources")))

print('resources 1: ' + RESOURCES)

else:
import pkg_resources

RESOURCES = pkg_resources.resource_filename("Nagstamon", "resources")

print('resources 2: ' + RESOURCES)


except Exception as err:
# get resources directory from current directory - only if not being set before by pkg_resources
# try-excepts necessary for platforms like Windows .EXE
Expand Down Expand Up @@ -1096,6 +1102,10 @@ def __init__(self, **kwds):
for path in paths_to_check:
if os.path.exists(path):
RESOURCES = path
print('resources 3: ' + RESOURCES, paths_to_check)

break
else:
RESOURCES = str(Path(__file__).parent.absolute().joinpath('resources'))

print('resources 4: ' + RESOURCES)

0 comments on commit 92fd4e4

Please sign in to comment.