Community
    • Login

    [8.6.2] Display live console to work with Python script?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    6 Posts 3 Posters 620 Views
    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.
    • S
      Shohreh
      last edited by

      Hello,

      I’d like to find how to get NppExec to display the output from a Python script in a console within NPP so I don’t need to switch back and forth to Windows’ cmd window.

      Thank you.

      aeae22a0-b20c-4ddc-8a55-d7b9a30fc8dd-image.png

      PeterJonesP EkopalypseE 2 Replies Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Shohreh
        last edited by PeterJones

        @Shohreh said in [8.6.2] Display live console to work with Python script?:

        Hello,

        I’d like to find how to get NppExec to display the output from a Python script in a console within NPP so I don’t need to switch back and forth to Windows’ cmd window.

        Then congratulations, you have succeeded. The screenshot you included showed it is indeed putting the output into the Book exec console in Notepad++.

        Unfortunately, your Python has an error, so the error is the only output that you see. Try a simple Hello World to see it “work”

        –
        update: sorry, that’s showing my obvious lack of knowledge about exit in Python; see more knowledgeable posts below

        1 Reply Last reply Reply Quote 1
        • EkopalypseE
          Ekopalypse @Shohreh
          last edited by Ekopalypse

          @Shohreh

          Read about what sys.exit does.
          If interactive mode is required, then use os._exit(WHATEVER_NUMBER) instead.

          S 1 Reply Last reply Reply Quote 1
          • S
            Shohreh @Ekopalypse
            last edited by

            I also tried quit(), still no output — Can’t post as text since the forum assumes it’s a link.

            The code works fine when ran from a cmd window.

            Too bad.

            82912603-df7e-4909-83b4-855116c39080-image.png

            EkopalypseE 1 Reply Last reply Reply Quote 0
            • EkopalypseE
              Ekopalypse @Shohreh
              last edited by

              @Shohreh

              but now you have changed the way in which the Python script is executed. In the previous example you executed python directly, now you start a cmd that executes the python script itself.
              As said before, if you want to switch to interactive mode, use os._exit(1) for example, if not, then you can use quit() as long as you understand what it does.

              EkopalypseE 1 Reply Last reply Reply Quote 2
              • EkopalypseE
                Ekopalypse @Ekopalypse
                last edited by

                @Ekopalypse said in [8.6.2] Display live console to work with Python script?:

                then you can use quit() as long as you understand what it does.

                Correction: this should actually read:

                then you can use exit() as long as you understand what it does.

                1 Reply Last reply Reply Quote 2
                • First post
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors