User to user discussion and support for UltraEdit, UEStudio, UltraCompare, and other IDM applications.

Help with setting up and configuring custom user tools in UltraEdit (based on command line input)
5 posts Page 1 of 1
Does anybody know how to capture outputs/print statements from a python script running through a user tool?

As of right now I can't seem to get the statements to update as they're printed like they do if I run the script from a python shell, or a plugin with Notepad++. I get all statements at the very end of the script, which makes the print statements not very useful. In my tool configuration I have the following settings:

Code: Select all
             Menu item name:
                Run Script in Python
             Command line:
                C:\Python27\ArcGIS10.2\python.exe %F
            DOS program
            Save active file

           Show DOS box
           Capture output
           Output to list box
           Captured output

I've found a few other threads regarding this, but no solutions. Thanks for any input you might be able to provide.
Hm, everything looks right. UltraEdit should open a console window with those settings and output written by console version of Python interpreter into the console window should be displayed in the "DOS box" and additionally captured by UltraEdit to list everything finally in output window.

If I configure a user tool with your settings with selecting No replace instead of Captured output for Replace selected text with and with command line changed to C:\Temp\Test.bat "%f" and the batch file contains the lines

Code: Select all
@echo off
dir "%~dp1"

and running this tool, a console window opens listing everything in directory of active file and waiting for a key press to finish. Once I pressed the key RETURN, the window closes as batch processing finished and I see the lines captured to output window.

Do you have read already showing captured output as program runs? and Setting up UE to run the Python interpreter?

What happens with your command line changed to C:\Python27\ArcGIS10.2\uepython.bat "%f" and batch file containing the line:

Code: Select all
@C:\Python27\ArcGIS10.2\python.exe %*

Does it make a difference regarding displaying the output written to stdout or stderr by your application respectively Python interpreter?
Best regards from Austria
I read those previous posts with no luck. Python runs the same with no print statements given until the script has finished. I even tried running it as a Microsoft Program, with the same results.
I tried your suggestions, but unfortunately I'm still getting all print statements at the end of the script. Not sure what the issue is
Do you see all Python output immediately when you open a command prompt window and run from within this window the Python interpreter with your script?

What happens when running from command prompt window Python with your script and output is redirected into a log file which is opened for viewing in UltraEdit while the script runs? Do you see each output directly in log file?

Some applications detect if output is written directly to console and do a flush after every line (after each \n - line end flush) while when output is redirected to a file buffer the output stream is flushed only after every few KB (usually 4 KB) and of course at end of application.

What happens when configuring in UltraEdit for the user tool to show DOS box, but do not capture the output?
Best regards from Austria
Configuring in UltraEdit for the user tool to show DOS box, but not to capture the output worked! Now I'm seeing all my print statements as I should in the DOS box.
Thank you so much for you help with this issue, you're a life saver!
5 posts Page 1 of 1