Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App freezes when running commands like python3 filename.py #6

Open
Moosems opened this issue May 21, 2023 · 7 comments
Open

App freezes when running commands like python3 filename.py #6

Moosems opened this issue May 21, 2023 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@Moosems
Copy link
Collaborator

Moosems commented May 21, 2023

When I run a Python file that uses tkinter, re-focusing the app shows that its confused as there is the rotating wheel of death.

@littlewhitecloud littlewhitecloud added the duplicate This issue or pull request already exists label May 26, 2023
@Moosems
Copy link
Collaborator Author

Moosems commented May 26, 2023

Actually, they're slightly different. #4 is about REPLs and how you can't give input whereas this is about if you run a command that takes a long time, the app freezes.

@littlewhitecloud
Copy link
Owner

Okay. I just mean the app freezes just like #4

@littlewhitecloud littlewhitecloud added bug Something isn't working and removed duplicate This issue or pull request already exists labels May 26, 2023
@sumeshir26
Copy link

Actually, they're slightly different. #4 is about REPLs and how you can't give input whereas this is about if you run a command that takes a long time, the app freezes.

Tkinter marks the window as not responding if the app does not respond for 5 seconds. Since the app currently freezes its process till the command finishes executing, if the command lasts 5+ secs the app freezes.

@Moosems
Copy link
Collaborator Author

Moosems commented May 26, 2023

Correct, but running any tkinter apps from the terminal will cause issues (an example).

@littlewhitecloud
Copy link
Owner

So, is there any way to solve this problem?

@Moosems
Copy link
Collaborator Author

Moosems commented May 27, 2023

Thats a great question. My current idea is this:

Right now, the way the terminal works is to run the command on <Return>. The running of this command takes place in an event which must complete before anything else can happen. To fix this, we could possibly do the following:

  1. On return, the cmd is created along with the subprocess which is saved into a variable
  2. The Popen stdout is put into a temporary file (in the cache dir) and is allowed to keep writing there as it goes
  3. The Popen is then started but we allow the after to end while doing two things: 1. while the subprocess is not completed we check the file every 50 ms or so and check if it spits out anything to be put into the console 2: we allow input during this time to be pushed to the subprocess 3. we set an after to run once the process is complete that will put in the directory and whatnot
  4. I might add that in this type the user can also cancel the subprocess with Control-c

This could theoretically prevent the app from crashing, open to new ideas though.

@littlewhitecloud
Copy link
Owner

Thats a great question. My current idea is this:

Right now, the way the terminal works is to run the command on <Return>. The running of this command takes place in an event which must complete before anything else can happen. To fix this, we could possibly do the following:

  1. On return, the cmd is created along with the subprocess which is saved into a variable
  2. The Popen stdout is put into a temporary file (in the cache dir) and is allowed to keep writing there as it goes
  3. The Popen is then started but we allow the after to end while doing two things: 1. while the subprocess is not completed we check the file every 50 ms or so and check if it spits out anything to be put into the console 2: we allow input during this time to be pushed to the subprocess 3. we set an after to run once the process is complete that will put in the directory and whatnot
  4. I might add that in this type the user can also cancel the subprocess with Control-c

This could theoretically prevent the app from crashing, open to new ideas though.

wow, great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants