brentvollebregt / auto-py-to-exe

Converts .py to .exe using a simple graphical interface
MIT License
3.95k stars 677 forks source link

Relative Paths aren't resolved until in the temp directory #486

Closed adalfarus closed 3 months ago

adalfarus commented 4 months ago

Quick Checks

Describe the bug

Relative paths to resources aren't resolved until it's compiling which usually isn't the indented usage.

To Reproduce

  1. Open Auto-Py-To-Exe and setup some basic settings
  2. Use relative paths for extra files, icon, ...
  3. Compile and see an error similar to : "Compilation stopping, couldn't find ..../temp_18275/data"

Expected behavior

It should resolve all relative paths and then start the compilation process.

Your Environment:

github-actions[bot] commented 4 months ago

👋 Hi, just a reminder that if you haven't read the help post yet, give it a read to see if your issue is covered in it and make sure to follow the debugging section.

Also please note, as stated in the README, if your issue is only associated with your application and not auto-py-to-exe itself, please do not create an issue in this repository - instead, comment on the help post, video or create a new discussion.

adalfarus commented 4 months ago

The reason I'm not posting this to pyinstaller is because that is a commandline tool. You can change the arguments and resolve relative paths using a script file, but auto-py-to-exe can only accept predefined settings using a json file, so doing it like that is a lot harder and more error prone.

brentvollebregt commented 4 months ago

Thanks for raising this - I see how this could be an issue.

Looks like I need to add a function like convert_path_to_absolute to the window to help with generating the current command. Will fix this when I get some time next 👌

brentvollebregt commented 4 months ago

Ah yes, I see PyInstaller makes the icon relative to the .spec file if it is provided as a relative path; see here. Since we make the .spec file generate in a temporary directory, it's making the calculated path relative to the temporary directory - which is not what we want.

Doesn't look like we can do any path magic, will need to go with a function like convert_path_to_absolute as described above before creating the current command.

brentvollebregt commented 3 months ago

This should be fixed in #493 - drop a comment here if there is still an issue around this.