[GH-ISSUE #73] File not found when ran as exe #70

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

Originally created by @ghost on GitHub (Sep 29, 2019).
Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/73

say i'm trying to read from .txt file.

with open( 'file', 'r' ) as file: for line in file.readlines() print( line )

It'll say that 'file' does not exist, but if run the same code in Spyder or PyCharm it will run fine

Originally created by @ghost on GitHub (Sep 29, 2019). Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/73 say i'm trying to read from .txt file. `with open( 'file', 'r' ) as file: for line in file.readlines() print( line )` It'll say that 'file' does not exist, but if run the same code in Spyder or PyCharm it will run fine
kerem closed this issue 2026-02-26 12:20:23 +03:00
Author
Owner

@brentvollebregt commented on GitHub (Sep 30, 2019):

If you're referencing the file relatively to the project, have you added the file you're referencing as an additional file?

Also can you please supply the command that is shown at the bottom of the UI.

<!-- gh-comment-id:536497812 --> @brentvollebregt commented on GitHub (Sep 30, 2019): If you're referencing the file relatively to the project, have you added the file you're referencing as an additional file? Also can you please supply the command that is shown at the bottom of the UI.
Author
Owner

@ghost commented on GitHub (Oct 1, 2019):

Oh I don’t think so, think I was added the folders instead lol. I’ll try
that, thanks

On Mon, Sep 30, 2019 at 5:14 AM Brent Vollebregt notifications@github.com
wrote:

If you're referencing the file relatively to the project, have you added
the file you're referencing as an additional file?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/brentvollebregt/auto-py-to-exe/issues/73?email_source=notifications&email_token=AG5JSSQD54KG34WHLAEPWALQMHGRTA5CNFSM4I3UN7KKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD75E5FA#issuecomment-536497812,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AG5JSSQAROPDTBWIFQOBYADQMHGRTANCNFSM4I3UN7KA
.

<!-- gh-comment-id:537033374 --> @ghost commented on GitHub (Oct 1, 2019): Oh I don’t think so, think I was added the folders instead lol. I’ll try that, thanks On Mon, Sep 30, 2019 at 5:14 AM Brent Vollebregt <notifications@github.com> wrote: > If you're referencing the file relatively to the project, have you added > the file you're referencing as an additional file? > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <https://github.com/brentvollebregt/auto-py-to-exe/issues/73?email_source=notifications&email_token=AG5JSSQD54KG34WHLAEPWALQMHGRTA5CNFSM4I3UN7KKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD75E5FA#issuecomment-536497812>, > or mute the thread > <https://github.com/notifications/unsubscribe-auth/AG5JSSQAROPDTBWIFQOBYADQMHGRTANCNFSM4I3UN7KA> > . >
Author
Owner

@ghost commented on GitHub (Oct 1, 2019):

Getting same issue, when trying to open data from another file it says No such file or directory -> 'C:\Users\User\AppData\Local\Temp\_MEI168562\THEMAINDIR\SUBDIR\SUBDIR2'

Even after adding additional folders. 'THEMAINDIR\SUBDIR\SUBDIR2'.

It works in the IDE but not as exe.

<!-- gh-comment-id:537207391 --> @ghost commented on GitHub (Oct 1, 2019): Getting same issue, when trying to open data from another file it says No such file or directory -> 'C:\\Users\\User\\AppData\\Local\\Temp\\_MEI168562\\THEMAINDIR\\SUBDIR\\SUBDIR2' Even after adding additional folders. 'THEMAINDIR\\SUBDIR\\SUBDIR2'. It works in the IDE but not as exe.
Author
Owner

@brentvollebregt commented on GitHub (Oct 2, 2019):

In the debugging help I provide, I state that you should use one directory mode when debugging as it makes it a lot easier to see what's in the output structure.

When using one directory mode, are the files you're trying to access present? You can locate them in the output directory.

<!-- gh-comment-id:537314210 --> @brentvollebregt commented on GitHub (Oct 2, 2019): In the [debugging help I provide](https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe/#debugging), I state that you should use one directory mode when debugging as it makes it a lot easier to see what's in the output structure. When using one directory mode, are the files you're trying to access present? You can locate them in the output directory.
Author
Owner

@ghost commented on GitHub (Oct 6, 2019):

Yeah the folder is in the output dir, but it renames the the with and 'i' and the beginning of the name... like the folder is added as an additional too.

Actual folder name: Quar.
Error Output: No such file or directory iQuar.

<!-- gh-comment-id:538772333 --> @ghost commented on GitHub (Oct 6, 2019): Yeah the folder is in the output dir, but it renames the the with and 'i' and the beginning of the name... like the folder is added as an additional too. Actual folder name: Quar. Error Output: No such file or directory iQuar.
Author
Owner

@brentvollebregt commented on GitHub (Oct 6, 2019):

Can you please supply the command that is shown at the bottom of the UI (asked in my first reply)

<!-- gh-comment-id:538778485 --> @brentvollebregt commented on GitHub (Oct 6, 2019): Can you please supply the command that is shown at the bottom of the UI (asked in my first reply)
Author
Owner

@ghost commented on GitHub (Oct 6, 2019):

pyinstaller -y -i "C:/Users/User/OneDrive/Desktop/Hopstarter-Malware-Search.ico" --add-data "C:/Users/User/OneDrive/Desktop/Antimalware X/poison/iQUAR";"iQUAR/" "C:/Users/User/OneDrive/Desktop/Antimalware X/127Sec.py"

<!-- gh-comment-id:538791332 --> @ghost commented on GitHub (Oct 6, 2019): pyinstaller -y -i "C:/Users/User/OneDrive/Desktop/Hopstarter-Malware-Search.ico" --add-data "C:/Users/User/OneDrive/Desktop/Antimalware X/poison/iQUAR";"iQUAR/" "C:/Users/User/OneDrive/Desktop/Antimalware X/127Sec.py"
Author
Owner

@brentvollebregt commented on GitHub (Oct 6, 2019):

The section

"C:/Users/User/OneDrive/Desktop/Antimalware X/poison/iQUAR";"iQUAR/"

shows that you have specified for the iQUAR folder to be put into the iQUAR/ directory. Is this not what you have specified in the UI?

<!-- gh-comment-id:538793521 --> @brentvollebregt commented on GitHub (Oct 6, 2019): The section > "C:/Users/User/OneDrive/Desktop/Antimalware X/poison/iQUAR";"iQUAR/" shows that you have specified for the `iQUAR` folder to be put into the `iQUAR/` directory. Is this not what you have specified in the UI?
Author
Owner

@ghost commented on GitHub (Oct 6, 2019):

no i was just adding the folder to see if it would work

<!-- gh-comment-id:538793762 --> @ghost commented on GitHub (Oct 6, 2019): no i was just adding the folder to see if it would work
Author
Owner

@brentvollebregt commented on GitHub (Oct 6, 2019):

What are you expecting to happen? You have specified that the folder is copied to the iQUAR directory, why would it then be put it Quar when you have not told it to be copied there?

<!-- gh-comment-id:538793974 --> @brentvollebregt commented on GitHub (Oct 6, 2019): What are you expecting to happen? You have specified that the folder is copied to the `iQUAR` directory, why would it then be put it `Quar` when you have not told it to be copied there?
Author
Owner

@ghost commented on GitHub (Oct 6, 2019):

So if i don't add that folder and an additional i still get

No such file or directory: 'C:\Users\User\output\127Sec\poison\iiQUAR\susmalware'
----> iiQUAR doesn't exist because there is no directory named iiQUAR, only iQUAR.

<!-- gh-comment-id:538794004 --> @ghost commented on GitHub (Oct 6, 2019): So if i don't add that folder and an additional i still get > No such file or directory: 'C:\\Users\\User\\output\\127Sec\\poison\\iiQUAR\\susmalware' ----> iiQUAR doesn't exist because there is no directory named iiQUAR, only iQUAR.
Author
Owner

@ghost commented on GitHub (Oct 6, 2019):

My goal is too move files into iQUAR\susmalware directory... but when turned into an exe the programs doesn't work, but will work fine in the ide.

<!-- gh-comment-id:538794164 --> @ghost commented on GitHub (Oct 6, 2019): My goal is too move files into iQUAR\susmalware directory... but when turned into an exe the programs doesn't work, but will work fine in the ide.
Author
Owner

@brentvollebregt commented on GitHub (Oct 6, 2019):

In the command you have shown me, you've told the application to copy the folder to iQUAR/. Why do you then expect it to be copied to iiQUAR when you have explicitly told it to copy to iQUAR/?

<!-- gh-comment-id:538794174 --> @brentvollebregt commented on GitHub (Oct 6, 2019): In the command you have shown me, you've told the application to copy the folder to `iQUAR/`. Why do you then expect it to be copied to `iiQUAR` when you have explicitly told it to copy to `iQUAR/`?
Author
Owner

@ghost commented on GitHub (Oct 6, 2019):

In my project there is no folder named 'iiQUAR', only with a single 'i'.
So idk where it's getting 'C:\Users\User\output\127Sec\poison\iiQUAR\susmalware' from when the actual path is 'C:\Users\User\output\127Sec\poison\iQUAR\susmalware'

<!-- gh-comment-id:538794379 --> @ghost commented on GitHub (Oct 6, 2019): In my project there is no folder named 'iiQUAR', only with a single 'i'. So idk where it's getting 'C:\Users\User\output\127Sec\poison\iiQUAR\susmalware' from when the actual path is 'C:\Users\User\output\127Sec\poison\iQUAR\susmalware'
Author
Owner

@brentvollebregt commented on GitHub (Oct 6, 2019):

Can you please provide a minimal reproducible example of this and the command you use to bundle the exe? I do not want to see your whole script, just the section that can reproduce this issue.

<!-- gh-comment-id:538794546 --> @brentvollebregt commented on GitHub (Oct 6, 2019): Can you please provide a **minimal** reproducible example of this and the command you use to bundle the exe? I do not want to see your whole script, just the section that can reproduce this issue.
Author
Owner

@ghost commented on GitHub (Oct 6, 2019):

Error starts here: shutil.move( file, __file__[:-13]+'{}'.format( 'iQUAR\\susmalware' ) )

One directory mode: > pyinstaller -y -i "C:/Users/User/OneDrive/Desktop/Hopstarter-Malware-Search.ico" "C:/Users/Users/OneDrive/Desktop/Antimalware X/127Sec.py"

<!-- gh-comment-id:538794881 --> @ghost commented on GitHub (Oct 6, 2019): Error starts here: `shutil.move( file, __file__[:-13]+'{}'.format( 'iQUAR\\susmalware' ) )` One directory mode: > pyinstaller -y -i "C:/Users/User/OneDrive/Desktop/Hopstarter-Malware-Search.ico" "C:/Users/Users/OneDrive/Desktop/Antimalware X/127Sec.py"
Author
Owner

@brentvollebregt commented on GitHub (Oct 6, 2019):

That command does not include the copying of files/directories whatsoever and can you please give a minimal reproducible example (that actually runs), not just one line.

<!-- gh-comment-id:538795029 --> @brentvollebregt commented on GitHub (Oct 6, 2019): That command does not include the copying of files/directories whatsoever and can you please give a minimal reproducible example (that actually runs), not just one line.
Author
Owner

@ghost commented on GitHub (Oct 6, 2019):

yeah i can, the thing is that the directory iQUAR is built into the exe, so it's not just a random made folder on the desktop or something.

<!-- gh-comment-id:538795431 --> @ghost commented on GitHub (Oct 6, 2019): yeah i can, the thing is that the directory iQUAR is built into the exe, so it's not just a random made folder on the desktop or something.
Author
Owner

@brentvollebregt commented on GitHub (Oct 7, 2019):

I cannot help if I cannot reproduce this situation myself.

Please provide a minimal reproducible example of what you are trying to do that demonstrates the iiQUAR folder creation.

<!-- gh-comment-id:539194379 --> @brentvollebregt commented on GitHub (Oct 7, 2019): I cannot help if I cannot reproduce this situation myself. Please provide a minimal reproducible example of what you are trying to do that demonstrates the `iiQUAR` folder creation.
Author
Owner

@brentvollebregt commented on GitHub (Oct 20, 2019):

It seems like "Billy" deleted their account so I don't imagine this will be getting resolved. Closing due to this reason.

<!-- gh-comment-id:544239108 --> @brentvollebregt commented on GitHub (Oct 20, 2019): It seems like "Billy" deleted their account so I don't imagine this will be getting resolved. Closing due to this reason.
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#70
No description provided.