omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Sending ctrl+C break signal in the terminal?

    Pythonista
    3
    4
    2820
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • altoidnerd
      altoidnerd last edited by

      Is it possible to send Ctrl + C ( SIGINT ) to break in the shell? That is something I use quite often, in any python shell. There are many use cases.

      1 Reply Last reply Reply Quote 0
      • omz
        omz last edited by

        Tapping the stop ([x]) button effectively does the same.

        1 Reply Last reply Reply Quote 1
        • altoidnerd
          altoidnerd last edited by altoidnerd

          To break execution during runtime, it behaves the same. But there are other cases (due to the syntax of python-language its not unique to pythonista and is shared by ALL shells).

          When in the shell, you enter functions and control sequences line by line - so you commit lines before execution. If you make an error, you need to break from that commitment to an indent-level to get your shell back (during this time, the button isn't available to do this, but that would be a good fix).

          example: this happens to me fairly often

          def do_something(x):
          ..if x not in [elm for elm in os.listdir('.').startswith('.')]:
          ....> # oh shoot. I meant to use os.environ not listdir
          ........> it thinks im still going. now I need to escape
          ....> just mashing buttons now
          ....>(*opovdv
          ......>;powef;l.
          ...>

          To be fair pythonista handles this better than ipython or cpython. cpython's shell is awful, and ipythons is great but has this syndrome really bad when it comes to functions... you'd have to use it to understand ...

          1 Reply Last reply Reply Quote 1
          • dgelessus
            dgelessus last edited by

            If you're not in a triple-quoted string, typing ;; is guaranteed to produce a syntax error, which breaks you out of the current "chunk". But yes, it would be great if you could use the [X] button to do that. (I think in Pythonista 1.4 that was possible and the feature was somehow lost in 1.5.)

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB Forums | Contributors