-
Couldn't load subscription status.
- Fork 750
win32 console debug #396
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
win32 console debug #396
Conversation
30e4214 to 6821ea4 Compare | Hi @stephenrauch, |
| Hi @stephenrauch, I just review the code. In general it looks good. But I'd like a few changes. (Hopefully you don't mind.)
If you don't have the time to fix any of this, then I'll do it. Thanks, |
| I will gladly make the changes. Give me a few days. Cheers, -- Stephen |
6821ea4 to e15f0af Compare e15f0af to dd1a838 Compare dd1a838 to 5e434bc Compare | So I have finally updated the pull request. I wanted to use it for a while to help make sure it was working ok. I am glad I did, as it needed a ^C handler. There are now no side effects of the import. I did however leave the Environment Variable as an option for invoking the functionality, for this reason: Editing the source code of my program between actually running it in the console, and running it under the debugger is rather a PITA. This way I can assign the environment variable in my debug environment, and it is largely a NOP when not debugging. The use of the environment variable is optional, as discussed in the docs, the functionality can be invoked without it. Hopefully this meets with your desires. If not, or you need anything else, please LMK. I have also added (a needed) ^C handler. |
| Thanks! This should become part of the next release. |
| @stephenrauch On the invoking side, I get A console window opens up which outputs So there is a connection followed by an exception. |
| @pe224 So I am reading right that there is no exception information printed? Also, what windows version? |
| @stephenrauch I also found a minor bug: if the path to python.exe contains spaces, there's an error, EDIT, Some new insights:
the error mentioned occurs. |
| Hi @stephenrauch, Excuse me for coming back just now. Regarding this pull request, I'm not sure what to do. I still think it's definitely valuable, but I'm not sure I have the resources and knowledge to maintain this piece as part of prompt_toolkit while it is evolving. I also think that it's perfectly feasible to implement all of this on top of prompt_toolkit, like it is right now. What about creating a prompt_toolkit_win32_debugger package or something like that? |
2abbf7d to 548a99e Compare | This pull request was never merged. Is there another solution for debugging while using an IDE? |
| @Spectrem12, PyCharm has now a built-in console emulator. It's not enable by default, but you can do this in the settings: I'm not sure, but VS Code probably has a similar option. Since Windows now has ConPTY (see https://devblogs.microsoft.com/commandline/windows-command-line-introducing-the-windows-pseudo-console-conpty/ ), any IDE can render a console. So, I don't think there's a need for this anymore. @stephenrauch : hope you're fine too if we close this? |
| I should have added more detail to my initial question. I have the emulator option checked but it limits the debugging and output capabilities or maybe I just don't know about pycharm. All the output is monochrome. The output buffer is limited. And you are not able to type inline python syntax within the emulator. I appreciate any solutions or work around you may have to offer. |
| Yes, I am also using the run button. Are those colors defined within the IDE itself or with an extension? I am using Grep Console and it no longer functions using the emulated window (not exactly prompt-toolkit issue) , but it causes other setbacks such as being able to pause debugging and input python commands inline. The terminal emulator is severely lacking in functionality. Is there a workaround to not force the terminal emulator? |


Debugging applications on windows under a debugger/ide can be difficult
because the IDE may use its own 'console' which Prompt Toolkit is unable
to use productively. This PR makes it possible to set an environment
variable which allows Prompt Toolkit to create a console window and
attach the appropriate handles to allow the program to use the console
productively.