I have a large Python project that I am working to make to an app, using Py2app. However, my main file includes a large number of imports, which cannot all be recognized by Py2app. Here is an example of the scale of this:
from Assets.Miscellaneous.formatting import Format
from Assets.Miscellaneous.inventory import InventoryCheck
from Assets.Health_Attack.stats import Stats
from Assets.Battle_System.battle_request import Battle_Request
from Assets.Health_Attack.items import Item
from maps import Position
from Assets.Health_Attack.merchants import Merchant
from Assets.Audio.audio_control import main_audio_loop
from Assets.Health_Attack.status_screen import print_status_screen
from Assets.Health_Attack.items import all_keys
from Assets.Miscellaneous.key_door_event import check_key_inventory, pass_door
from Assets.Visuals.neo_animation_system import show_graphic
from Assets.Miscellaneous.reset_game import full_reset
from Assets.Miscellaneous.neo_2_settings import settings
from Assets.Miscellaneous.bed_check import bed_check
from Assets.Miscellaneous.window_event import window_event
Here is my setup.py file:
from setuptools import setup
import os
APP = ['adventuregame.py']
DATA_FILES = [
'print_speed.txt', 'maps_data.py', 'current_enemy_health.txt', 'first_game.txt',
'map_size.txt', 'item_inventory_data.txt',
'audio_stop_check.txt', 'savedvariables.txt', 'player_stats.txt', 'inventory_data.txt',
'curr_pl_mat.txt', 'battle_happening.txt', 'money.txt', 'curr_pr_mat.txt',
'item_tracker.txt']
for index, item in enumerate(DATA_FILES):
DATA_FILES[index] =
"/Users/caspianahlberg/Desktop/Programming/Isolated_AG/Assets/Global_Vars/" + item
setup(
app=APP,
data_files=DATA_FILES,
setup_requires=['py2app']
)
I have a large number of text files that store data relating to the game that I am making. However, when running the executable generated, this error occurs:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/caspianahlberg/Desktop/Programming/Isolated_AG/dist/adventuregame.app/Contents/Resources/Assets/Global_Vars/current_enemy_health.txt' 2020-03-17 00:21:01.094 adventuregame[42211:18386951] adventuregame Error
So, the problem is that somehow, everything is not compiled in some way. This text file is in the wrong directory, which I am not sure how it happened. Please provide some help for my problem, it's really frustrating to deal with myself!