Skip to content

Regression? Faulty behaviour in PyCharm debug mode - Line break required, character limit not respected #126

Open

Description

@WildRikku

This looks like a regression or variation of #51

A simple decision = readchar.readchar() will not work in PyCharm's debug mode despite terminal emulation being active. Run mode works as expected. In debug mode, I can enter more than one character and also need to press Enter at the end. The resulting string contains all the characters and a line break.

I also noticed, and I am unsure if this is a separate issue, that I need to stop my script twice when readchar.readchar() is active, the first press of the stop button will send a character and only the second press will actually stop my script. I can open a separate issue if this is not related.

Package version is 4.2.1
Python version is 3.12
PyCharm version is 2025.2.1.1

Activity

  1. Cube707 commented on Sep 5, 2025

    @Cube707
    Collaborator

    What OS are you using?

    In debug mode, I can enter more than one character and also need to press Enter at the end. The resulting string contains all the characters and a line break.

    This sound like it stems from PyCharm caching your input until you press enter and only than sending the whole string. On why it returnes more than one character I am confused.

    I also noticed, and I am unsure if this is a separate issue, that I need to stop my script twice

    This depends on how PyCharm is trying to interrupt your programm. readchar is only responsible if PyCharm is sending a CTRL+C character (so a 0x03 byte). If PyCharm trys other methods, like sending SIGINT or similar, that's not related to readchars functionality directly

  2. WildRikku commented on Sep 5, 2025

    @WildRikku
    Author

    What OS are you using?

    SteamOS, so PyCharm is installed as a Flatpak.

    This depends on how PyCharm is trying to interrupt your programm. readchar is only responsible if PyCharm is sending a CTRL+C character (so a 0x03 byte). I PyCharm tryth other methods, like sending SIGINT or similar, that's not related to readchars functionality directly

    I see. I think it sends SIGKILL, at least that's what it reports when it succeeds. Might also be SIGTERM before or something like that. I will investigate.

  3. Cube707 commented on Sep 5, 2025

    @Cube707
    Collaborator

    SteamOS

    OK, so linux based

    I just tested on windows and can confirm that PyCharm is doing some wird stuff when starting a python programm. But it works as expected when using the integrated terminal and manually starting python tests/manual-tests.py, so its seems to be a issue with the IDE, not readchar...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions