0

Logging to RV console using color codes from Python?

I have been trying to print to RV's console from Python with color codes. Although my text appears there, they do not get color coded when they are prefixed with "ERROR", "INFO" and "WARNING".

When I look at existing *.mu scripts it appears that they only use the print function and then prefixes the message with ERROR/INFO/WARNING but when I do the same in Python nothing happens. I even tried to run mu from Python:

import rv.commands as cmd

cmd.eval("{print('ERROR: This message will not be color coded.');}")

But again, no color codings. If it matters, I do my testing in ~/.rvrc.py and then execute rv in a terminal.

1 comment

  • 0
    Avatar
    Andreas Ekoutsidis

    Alright, I figured it out myself! =) When printing directly inside the ~/.rvrc.py the interface has probably not yet loaded, so if I would run:

    print "ERROR: This is an error!"

    I get this error in the terminal:

    no backtrace available

    If I instead put the print statement in either setup() or initialize() function in the same file, the print will correctly print to RV's console as expected!

Please sign in to leave a comment.