How to run Python programs from UltraEdit?

How to run Python programs from UltraEdit?

2
NewbieNewbie
2

    Nov 30, 2018#1

    Does anyone know of a way to debug and run Python programs from UltraEdit?

    6,684587
    Grand MasterGrand Master
    6,684587

      Nov 30, 2018#2

      It would be good to add some additional information about your environment to give you detailed instructions really working for you.

      On which operating system do you use UltraEdit? Is it Windows, Linux or Mac? And which version of the operating system do you use?

      Which version of UltraEdit do you use?

      Open About dialog of UltraEdit, select UltraEdit application title and version information, press Ctrl+C to copy selected information and paste it with Ctrl+V into edit field of your next post.

      Which user interface mode do you use? Do you use ribbon mode being the default since UltraEdit for Windows, or toolbar/menu mode with contemporary menus available since version 23.00 on Windows, or toolbar/menu mode with traditional menus being available since version 23.20 on Windows and the only available user interface mode for UltraEdit for Windows < 23.00 and for UltraEdit on Linux and Mac?

      How do run and debug your Python scripts from Windows command line or in a Linux/Mac terminal (shell)?

      What do you know already about user tools and project tools and their configuration in UltraEdit to use for running an interpreter like python.exe (Windows console ("DOS") version) or pythonw.exe (Windows GUI version) or python (Linux/Mac shell)?

      UltraEdit as very powerful general text editor has built-in no items/commands for Python developing and debugging as some IDEs designed specifically for code writing in certain programming and scripting languages including Python have. For that reason it is necessary to configure UltraEdit for enhanced developing for a certain compiler or interpreter like Python.
      Best regards from an UC/UE/UES for Windows user from Austria

      2
      NewbieNewbie
      2

        Dec 01, 2018#3

        I am working on the most recent update of Windows 10 version 1803. The UltraEdit I am using is version 25.20.0.88.

        6,684587
        Grand MasterGrand Master
        6,684587

          Dec 01, 2018#4

          Okay, I have not installed Python nor was Python ever installed on any of my computers running on Windows. So I hoped that you write something about your usage of Python from Windows command line.

          However, click on ribbon tab Advanced in first group Tools on last item User tools and next on opened pop-up menu on first menu item Configure tools.Click first on button Help to open help page for configuring a user tool and make use of it to understand the following. Then click on button Insert to insert/add the first user tool for example with following options:

          Menu item name: Run Python script
          Command line: "C:\Path to\Python Executable\python.exe" "%f"
          Working directory: %p
          Toolbar bitmap/icon: empty or name of a suitable image file for this tool with full path

          Second tab Options:

          Program type: DOS program
          Save active file: Checked
          Save all files first: NOT checked (or also checked, your choice)

          Third tab Output:

          Command output: Output to list box
          Show DOS box: NOT checked
          Capture output: checked
          Replace selected text width: No replace
          Handle output as: ANSI (or UTF-8 or UTF-16 depending on encoding used by your Python scripts to write to console)

          Click on button OK and this user tool is now ready for usage. The first user tool can be executed by pressing key Ctrl+Shift+1 assigned by default to command User tool 1. This assignment can be modified at Advanced - Settings or Configuration - Key mapping. It can be also executed by clicking again on ribbon tab Advanced in first group Tools on last item User tools and next on opened pop-up menu on second menu item Run Python script. It is also possible to add the user tool to a custom ribbon tab in a custom ribbon group (ribbon mode) or a toolbar (toolbar/menu mode) for a quicker usage with pointing device (mouse).

          For Python scripts which output by design nothing to console, more precise the handles stdout (standard output) and stderr (standard error), create one more user tool as Copy of the first tool for example with menu item name Execute Python script, use pythonw.exe in command line instead of python.exe, select Windows program on tab Options instead of DOS program, select Append to existing instead of Output to list box and do not check Capture output. See also pythonw.exe or python.exe?

          For Python scripts which require interaction with a user because of waiting for data entered by keyboard or read from handle stdin (standard input) during execution of the script, create one more user tool as Copy of the first tool for example with menu item name Interactive Python script, select Append to existing instead of Output to list box and do not check Capture output.

          For debugging Python scripts, create one more user tool as Copy of the first tool for example with menu item name Debug Python script, select Append to existing instead of Output to list box and do not check Capture output and add -d argument option to command line of this user tool before "%f" which should run Python in debug mode according to online documentation Python command line and environment which I honestly have not read from top to bottom as I don't want to become a Python script writer.

          It is of course possible to run a batch file instead of directly python.exe to first setup a specific environment like defining environment variables and then runs python.exe with the script file name passed with full path from UltraEdit via "%f" to the batch file which passes it further to python.exe for example with %* (all arguments except argument 0 being the batch file argument).

          Further I recommend reading:
          Best regards from an UC/UE/UES for Windows user from Austria

          12
          NewbieNewbie
          12

            Mar 30, 2020#5

            @Mofi 
            I had to create an account especially - just so I could thank you for taking the time and using your amazing knowledge to answer this question for edmac43.

            I know he didn't answer you or say thank you, but I wanted you to know that the answer you provided is perfect and will save me countless hours of manually running a tester on my scripts, and I am sure I am not the only person who values your input immensely.

            So thank you, keep up the GOOD fight :-D 

            1
            NewbieNewbie
            1

              Sep 04, 2021#6

              @Mofi - You put this in nearly 3 years ago.  And today it absolutely answered what I was looking for.  Thank you so much for being so thorough back in 2018!  It is as useful today as it was back then.

              1

                Sep 08, 2021#7

                I am teaching Python to non-programmers (who use MS Windows daily). I don't use Windows and have no idea of the best tools (text editor, IDE or such) and the best practices there. Something as easy as a virtualenv/easy_install becomes very complicated for me in non-console-land.

                Please suggest what you think are the best tools for python development on the Windows platform that a beginner can start using from day 0 (with some little help).

                I am particularly interested in a good (and not bloated) text editor with basic syntax highlighting/basic 'run program' features. I'm currently using SciTE and it's not bad, but maybe you know better choices. A full blown IDE would be okay too, unless it's the very slow Eclipse.

                6,684587
                Grand MasterGrand Master
                6,684587

                  Sep 10, 2021#8

                  @Sebastianvd This is an UltraEdit user to user forum. You will not get here general recommendations.

                  UltraEdit is a very powerful shareware text editor which can be heavily customized by a user for his/her needs. Python syntax highlighting with code folding and indent lines is supported by UltraEdit. The execution of a Python script can be done via user or project tool.

                  UEStudio is an IDE based UltraEdit. It has additional features for Python programmers. There is built-in the support to run Python scripts. The user has to configure only the path to the Python executable, see the help page Settings:Integrated applications:Python. UEStudio offers also a dialog window to set Python parameters for execution of a Python script and support for execution of Pylint to check the Python code in active file, see the help page about the Coding tab.

                  It is of course also possible to use Pylint with UltraEdit by configuring a user tool to run Pylint on active Python script file.
                  Best regards from an UC/UE/UES for Windows user from Austria