0

I've developed a game in python using Pygame. So far bundling it using pyinstaller has caused me zero issues when bundling it and running it on a different machine. Steam can install the game, and navigating to its local directory and launching the .exe will allow the game to run but anytime I attempt to run it through the steam launcher it tells me files are missing, even though I know they're in the local install directory.

Any ideas on what may be causing such an issue?

  • You probably can contact steam directly for such a thing. – Saelyth Jun 23 '20 at 23:08
  • Doing so currently. Thought I'd drop in here during the meantime. – Liam Iverson Jun 23 '20 at 23:16
  • Check that the directory your program is trying to load the files from is actually the current directory. Log `os.getcwd()` on startup or suchlike. Maybe it's something like `"C:/SteamLauncher/"` whereas your code is expecting `"C:/SteamLauncher/MyInstaller/Files/"`. If you find this to be the problem, please answer your own question with a solution. A similar (unanswered) question was asked last week, it's a common problem. – Kingsley Jun 24 '20 at 00:08
  • 2
    program can run in different folder then you expect and it may needs something like `os.path.dirname(__file__)` or `os.path.dirname(sys.argv[0])`, etc. to get folder in which it runs code and use this path to load files. [Determining application path in a Python EXE generated by pyInstaller](https://stackoverflow.com/questions/404744/determining-application-path-in-a-python-exe-generated-by-pyinstaller) – furas Jun 24 '20 at 00:13
  • That would make sense. I'm in contact with Steam support now and inquired if steam might be changing the current working directory on launch. I'll report my findings so this can be resolved properly. – Liam Iverson Jun 24 '20 at 03:56

1 Answers1

0

So after taking user Kingsleys advice and using "os.getcwd()" to see where exactly Steam was launching the game from I noticed it was treating the directory 1-up from the location of the .exe as the actual working directory. To resolve this problem all I had to do was change my package layout so that my assets were stored in this folder.

No longer facing an issues with this.