[GH-ISSUE #441] time.sleep() is not working correctly #349

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

Originally created by @revolexGeek on GitHub (Nov 8, 2023).
Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/441

Quick Checks

  • I have read/searched in the help post
  • I have searched other issues, looking for an issue similar to mine
  • I have made sure my application/script runs before trying to package

Describe the bug
When running an application through a Python file (.py), the time.sleep(x) command works fine, but after compiling through auto-py-to-exe, it happens that no time.sleep(x) is triggered and the program runs straight through without the necessary stops.

To Reproduce
Steps to reproduce the behavior (install dependencies, do this in the auto-py-to-exe UI):
0. Run python code via python main.py and see that everything works fine!

  1. Compile code via auto-py-to-exe GUI ~
    1.1. Select One File
    1.2. Select Console Based
    1.3. Select some icon
    1.4. Give it some name in Advanced category
    1.5. Compile (convert) it.
  2. Run converted executable file and see that everything isnt fine with sleeps between function calls.

A minimal reproducible example:

import time

def main_sleep_test_example():
    print("Sleep test example")
    while True:
        print("Sleeping...")
        time.sleep(3)
        print("Wake up!")


if __name__ == '__main__':
    main_sleep_test_example()

Live representation of error
Error

Expected behavior
Delays had to be triggered so that the functioning of the converted program was identical to that of the unconverted program.

Your Environment:

  • Python version (python --version): 3.9.0
  • auto-py-to-exe version (pip show auto-py-to-exe): 2.42.0
  • PyInstaller version (pip show pyinstaller): 6.1.0
  • Eel version (pip show eel): 0.16.0
Originally created by @revolexGeek on GitHub (Nov 8, 2023). Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/441 **Quick Checks** - [x] I have read/searched in the [help post](https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe) - [x] I have [searched other issues](https://github.com/brentvollebregt/auto-py-to-exe/issues?q=is%3Aissue+), looking for an issue similar to mine - [x] I have made sure my application/script runs before trying to package **Describe the bug** When running an application through a Python file (.py), the time.sleep(x) command works fine, but after compiling through auto-py-to-exe, it happens that no time.sleep(x) is triggered and the program runs straight through without the necessary stops. **To Reproduce** Steps to reproduce the behavior (install dependencies, do this in the auto-py-to-exe UI): 0. Run python code via `python main.py` and see that everything works fine! 1. Compile code via auto-py-to-exe GUI ~ 1.1. Select `One File` 1.2. Select `Console Based` 1.3. Select some icon 1.4. Give it some name in `Advanced` category 1.5. Compile (convert) it. 2. Run converted executable file and see that everything isnt fine with sleeps between function calls. **A minimal reproducible example:** ```python import time def main_sleep_test_example(): print("Sleep test example") while True: print("Sleeping...") time.sleep(3) print("Wake up!") if __name__ == '__main__': main_sleep_test_example() ``` **Live representation of error** ![Error](https://github.com/brentvollebregt/auto-py-to-exe/assets/86723750/a277dc18-b4a6-47e5-a366-62404730b25a) **Expected behavior** Delays had to be triggered so that the functioning of the converted program was identical to that of the unconverted program. **Your Environment:** - Python version (`python --version`): 3.9.0 - auto-py-to-exe version (`pip show auto-py-to-exe`): 2.42.0 - PyInstaller version (`pip show pyinstaller`): 6.1.0 - Eel version (`pip show eel`): 0.16.0
kerem 2026-02-26 12:21:18 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@github-actions[bot] commented on GitHub (Nov 8, 2023):

👋 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.

<!-- gh-comment-id:1800676222 --> @github-actions[bot] commented on GitHub (Nov 8, 2023): 👋 Hi, just a reminder that if you haven't read [the help post](https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe/) yet, give it a read to see if your issue is covered in it and make sure to follow [the debugging section](https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe/#debugging). 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](https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe/), [video](https://youtu.be/OZSZHmWSOeM) or create a [new discussion](https://github.com/brentvollebregt/auto-py-to-exe/discussions).
Author
Owner

@brentvollebregt commented on GitHub (Nov 8, 2023):

I've just tried to reproduce this with the following,

  • Python version: 3.9.9 (only difference)
  • auto-py-to-exe version: 2.42.0
  • PyInstaller version: 6.1.0
  • Eel version: 0.16.0

Unfortunately, this didn't happen for me - do you know if this only happens on Python 3.9.0?

<!-- gh-comment-id:1801402825 --> @brentvollebregt commented on GitHub (Nov 8, 2023): I've just tried to reproduce this with the following, - Python version: 3.9.9 (only difference) - auto-py-to-exe version: 2.42.0 - PyInstaller version: 6.1.0 - Eel version: 0.16.0 Unfortunately, this didn't happen for me - do you know if this only happens on Python 3.9.0?
Author
Owner

@revolexGeek commented on GitHub (Nov 8, 2023):

I've just tried to reproduce this with the following,

  • Python version: 3.9.9 (only difference)
  • auto-py-to-exe version: 2.42.0
  • PyInstaller version: 6.1.0
  • Eel version: 0.16.0

Unfortunately, this didn't happen for me - do you know if this only happens on Python 3.9.0?

I recently changed Python version from 3.8.0 to 3.9.0, while on 3.8.0 everything was great with auto-py-to-exe, but on 3.9.0 suddenly this happens 🤷

<!-- gh-comment-id:1801713073 --> @revolexGeek commented on GitHub (Nov 8, 2023): > I've just tried to reproduce this with the following, > > * Python version: 3.9.9 (only difference) > * auto-py-to-exe version: 2.42.0 > * PyInstaller version: 6.1.0 > * Eel version: 0.16.0 > > Unfortunately, this didn't happen for me - do you know if this only happens on Python 3.9.0? I recently changed Python version from 3.8.0 to 3.9.0, while on 3.8.0 everything was great with auto-py-to-exe, but on 3.9.0 suddenly this happens 🤷
Author
Owner

@brentvollebregt commented on GitHub (Nov 9, 2023):

Have you tried any other versions of Python above 3.9.0? Did any of those work?

Also if you run pyinstaller --noconfirm --onefile --console "path/to/file.py" (using PyInstaller from your Python 3.9.0 environment) and then run the output exe, does this also have the same issue?

<!-- gh-comment-id:1803111345 --> @brentvollebregt commented on GitHub (Nov 9, 2023): Have you tried any other versions of Python above 3.9.0? Did any of those work? Also if you run `pyinstaller --noconfirm --onefile --console "path/to/file.py"` (using PyInstaller from your Python 3.9.0 environment) and then run the output exe, does this also have the same issue?
Author
Owner

@MothScientist commented on GitHub (Nov 10, 2023):

Checked on 2 versions:

1:

  • Python version: 3.11.6
  • auto-py-to-exe version: 2.42.0
  • PyInstaller version: 6.1.0
  • Eel version: 0.16.0

The problem is not observed.

2:

  • Python version: 3.9.0
  • auto-py-to-exe version: 2.42.0
  • PyInstaller version: 6.1.0
  • Eel version: 0.16.0

The problem repeats itself, as stated in the description.

<!-- gh-comment-id:1806488405 --> @MothScientist commented on GitHub (Nov 10, 2023): Checked on 2 versions: ### 1: - Python version: 3.11.6 - auto-py-to-exe version: 2.42.0 - PyInstaller version: 6.1.0 - Eel version: 0.16.0 __The problem is not observed.__ ### 2: - Python version: 3.9.0 - auto-py-to-exe version: 2.42.0 - PyInstaller version: 6.1.0 - Eel version: 0.16.0 __The problem repeats itself, as stated in the description.__
Author
Owner

@MothScientist commented on GitHub (Nov 10, 2023):

I ran it like this: pyinstaller --noconfirm --onefile --console "path/to/file.py" - the problem repeats, no changes (version 3.9.0)

<!-- gh-comment-id:1806499369 --> @MothScientist commented on GitHub (Nov 10, 2023): I ran it like this: ```pyinstaller --noconfirm --onefile --console "path/to/file.py"``` - the problem repeats, no changes (version 3.9.0)
Author
Owner

@brentvollebregt commented on GitHub (Nov 13, 2023):

Thanks for running those, sorry for the late reply. The fact that this still happens when running pyinstaller ... shows the issue is with PyInstaller and not anything specific to auto-py-to-exe.

Unfortunately, there is nothing I can do about this in auto-py-to-exe. Still, you could raise it as a PyInstaller issue - your demo (code and gif) is excellent and the simple pyinstaller --noconfirm --onefile --console "path/to/file.py" command would be ideal to note in the issue as well as your PyInstaller and Python versions.

<!-- gh-comment-id:1807895423 --> @brentvollebregt commented on GitHub (Nov 13, 2023): Thanks for running those, sorry for the late reply. The fact that this still happens when running `pyinstaller ...` shows the issue is with [PyInstaller](https://github.com/pyinstaller/pyinstaller) and not anything specific to auto-py-to-exe. Unfortunately, there is nothing I can do about this in auto-py-to-exe. Still, you could raise it as a [PyInstaller issue](https://github.com/pyinstaller/pyinstaller/issues) - your demo (code and gif) is excellent and the simple `pyinstaller --noconfirm --onefile --console "path/to/file.py"` command would be ideal to note in the issue as well as your PyInstaller and Python versions.
Author
Owner

@MothScientist commented on GitHub (Nov 14, 2023):

Ok, I opened issue in the pyinstaller repository: https://github.com/pyinstaller/pyinstaller/issues/8104.
If something is wrong or forgot to add something, then please write a comment to issue.

<!-- gh-comment-id:1809846287 --> @MothScientist commented on GitHub (Nov 14, 2023): Ok, I opened issue in the __pyinstaller__ repository: https://github.com/pyinstaller/pyinstaller/issues/8104. If something is wrong or forgot to add something, then please write a comment to issue.
Author
Owner

@brentvollebregt commented on GitHub (Nov 14, 2023):

Looks excellent!

<!-- gh-comment-id:1809880428 --> @brentvollebregt commented on GitHub (Nov 14, 2023): Looks excellent!
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#349
No description provided.