Community
    • Login

    Script issue not showing in Notepad++

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 241 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.
    • Dr. Sylvain J.R. Garceau-BergeronD
      Dr. Sylvain J.R. Garceau-Bergeron
      last edited by

      Hello there.

      I have Python 3.12.6 and Notepad++8.6.8 just installed. Inside Notepad++, I have a very simple script like RUN $(FULL_CURRENT_PATH)
      . The code below works in the Python interpreter. But when I try ro run it in Notepad++, there is a quick black window that appears then goes away. I saw one post that said to have a statement in the Python script so that it waits for the user to press a key to continue. That wait for key code is the msvcrt.getch() statement. I was wondering why I don’t see the execution of the Python script? I am all new to do and I am looking forward to learn. Any

      Thanks
      import msvcrt, os

      coord_a = input ("Enter coord A: ")
      coord_b = input ("Enter coord B: ")
      print ("Coord a is " + coord_a + " .Coord b is " + coord_b)
      print(“Press any key to continue…”)
      msvcrt.getch()
      os.system(‘cls’)

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Dr. Sylvain J.R. Garceau-Bergeron
        last edited by

        @Dr-Sylvain-J-R-Garceau-Bergeron ,

        I am going to assume that you don’t actually type RUN $(FULL_CURRENT_PATH) into the Run dialog, because that’s obviously not what you’d type at a command line to get it to work – because python is the name of the interpreter, not run …

        When I do Run > Run… > python "$(FULL_CURRENT_PATH)" , it does exactly what I’d expect with your code: it opens the cmd.exe window, prompts for the inputs, then prompts to press any key to continue, then closes after it has cleared the screen.

        (Note: I use quotes around the $(FULL_CURRENT_PATH) so that the whole path will be passed to python, even if there is a space somewhere in the directory or filename)

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