Community
    • Login

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

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    6 Posts 3 Posters 1.2k Views 2 Watching
    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 Offline
      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 Online
        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 Offline
          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 Offline
            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 Offline
              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 Offline
                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

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                • First post
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors