[GH-ISSUE #316] Writing and Reading files is not permanently #277

Closed
opened 2026-02-26 12:21:03 +03:00 by kerem · 7 comments
Owner

Originally created by @FrenkyDema on GitHub (Sep 26, 2022).
Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/316

Description

My application use json file to write some information, when i try in my IDE there is no problem.
But when i transform the project in executable application

How to Reproduce

  • Create project with a Json file
  • Save text on file json
  • Close application
  • Reopen
  • File Json was load at previous version

My Environment:

  • Python version (3.10.6):
  • auto-py-to-exe version (2.23.1):
  • PyInstaller version (5.4.1):
  • Eel version (0.14.0):

Additional context

Test project -> TestIOReport

Originally created by @FrenkyDema on GitHub (Sep 26, 2022). Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/316 ## **Description** My application use json file to write some information, when i try in my IDE there is no problem. But when i transform the project in executable application ## **How to Reproduce** - Create project with a Json file - Save text on file json - Close application - Reopen - File Json was load at previous version ## **My Environment:** - Python version (`3.10.6`): - auto-py-to-exe version (`2.23.1`): - PyInstaller version (`5.4.1`): - Eel version (`0.14.0`): ## **Additional context** Test project -> [TestIOReport](https://github.com/FrenkyDema/TestIOReport/tree/main)
kerem closed this issue 2026-02-26 12:21:03 +03:00
Author
Owner

@brentvollebregt commented on GitHub (Sep 27, 2022):

There is quite a bit missing in your reproduction steps - specifically around bundling and running the executable.

Are you using one directory mode to package your application? Also did you follow the debugging steps before creating this issue? (means you would have used one directory before)

<!-- gh-comment-id:1259113402 --> @brentvollebregt commented on GitHub (Sep 27, 2022): There is quite a bit missing in your reproduction steps - specifically around bundling and running the executable. Are you using one directory mode to package your application? Also did you follow the debugging steps before creating this issue? (means you would have used one directory before)
Author
Owner

@FrenkyDema commented on GitHub (Sep 27, 2022):

There is quite a bit missing in your reproduction steps - specifically around bundling and running the executable.

Are you using one directory mode to package your application? Also did you follow the debugging steps before creating this issue? (means you would have used one directory before)

I'm using the one file mode, and if is possible I prefer to maintain that

<!-- gh-comment-id:1259123370 --> @FrenkyDema commented on GitHub (Sep 27, 2022): > There is quite a bit missing in your reproduction steps - specifically around bundling and running the executable. > > Are you using one directory mode to package your application? Also did you follow the debugging steps before creating this issue? (means you would have used one directory before) I'm using the one file mode, and if is possible I prefer to maintain that
Author
Owner

@FrenkyDema commented on GitHub (Sep 27, 2022):

For the reproduce steps u can check my test project I've linked in the issues report

<!-- gh-comment-id:1259124795 --> @FrenkyDema commented on GitHub (Sep 27, 2022): For the reproduce steps u can check my test project I've linked in the issues report
Author
Owner

@brentvollebregt commented on GitHub (Sep 27, 2022):

There is a help post that is linked in the README, top of auto-py-to-exe and bottom of auto-py-to-exe after each build. In this post, I discuss The Difference Between One Directory and One File - I highly recommend you give that a read.

I believe you are trying to overwrite a file that is part of the initial bundle and are expecting it to stay modified after each run - this is not how one-file mode works. one-file mode unbundles on each run meaning all modified files within the bundles are reset (more about this in the post).

<!-- gh-comment-id:1259128051 --> @brentvollebregt commented on GitHub (Sep 27, 2022): There is a help post that is linked in the README, top of auto-py-to-exe and bottom of auto-py-to-exe after each build. In this post, I discuss [The Difference Between One Directory and One File](https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe/#the-difference-between-one-directory-and-one-file) - I highly recommend you give that a read. I believe you are trying to overwrite a file that is part of the initial bundle and are expecting it to stay modified after each run - this is not how one-file mode works. one-file mode unbundles on each run meaning all modified files within the bundles are reset (more about this in the post).
Author
Owner

@FrenkyDema commented on GitHub (Sep 27, 2022):

Oooo I understand, so to edit files and have permanent changes there is no way to have everything as One file?

<!-- gh-comment-id:1259134453 --> @FrenkyDema commented on GitHub (Sep 27, 2022): Oooo I understand, so to edit files and have permanent changes there is no way to have everything as One file?
Author
Owner

@brentvollebregt commented on GitHub (Sep 27, 2022):

Changes will be kept when modifying files outside of the unpackaged package (like usual) - it is just the files within the exe that are reset.

Directly from the post I linked before:

Also due to the files being unpacked to a new temporary directory on execution, the files that you modified added that were in the same directory as the executable will not be there on the next run because they are now in a different unknown folder. This means when creating files, you will want to use an absolute path that is not where the project files are (could use something like APPDATA on Windows).

<!-- gh-comment-id:1259165828 --> @brentvollebregt commented on GitHub (Sep 27, 2022): Changes will be kept when modifying files outside of the unpackaged package (like usual) - it is just the files within the exe that are reset. Directly from the post I linked before: > Also due to the files being unpacked to a new temporary directory on execution, the files that you modified added that were in the same directory as the executable will not be there on the next run because they are now in a different unknown folder. This means when creating files, you will want to use an absolute path that is not where the project files are (could use something like APPDATA on Windows).
Author
Owner

@FrenkyDema commented on GitHub (Sep 27, 2022):

ok, ok sorry for the inconvenience, now I'll try

<!-- gh-comment-id:1259176839 --> @FrenkyDema commented on GitHub (Sep 27, 2022): ok, ok sorry for the inconvenience, now I'll try
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/auto-py-to-exe#277
No description provided.