im new to python i just started using for half a week and while making a programme, i encountered a problem when i press enter to enter an input the terminal close and i realize it not realy close it just disapear from my screen bc when i press enter again it open back up and it still in task manager when i test it in visual studio the code work perfectly fine why this happen?
#🔒 why my terminal automatically close when i enter an input
18 messages · Page 1 of 1 (latest)
@zenith fiber
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Closes after a period of inactivity, or when you send !close.
If you double click your py file to open it, it will keep a terminal window open for as long as your script is running. Likely after you press enter in your input(), your script finishes and the terminal window closes.
To keep it open, open a terminal window (cmd) first, then run your script with the py command
how do i do that
i thought if my code run in a while true loop it should stay open?
Maybe it's crashing
wait a min i send the code
how to format code again?
i cant send it it too long
but if it crashing shouldnt it crash in visual studio or give me error atleast?
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
i figured it out i got an error bc it cannot find a file now just have to figure out why it work in visual studio but no terminal
it could be because your vs sets up default paths for assets or certain files access
^ this could be the issue if your script is located in a subfolder relative to your project
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.