RoboDK Forum
Launch rdk using Robolink without printing rdk logs on stdout可打印版本

+- RoboDK Forum (//www.sinclairbody.com/forum)
+-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN)
+--- Forum: RoboDK API (//www.sinclairbody.com/forum/Forum-RoboDK-API)
+--- Thread: Launch rdk using Robolink without printing rdk logs on stdout (/ 3ad-Launch-rdk-using-Robolink-without-printing-rdk-logs-on-stdout)



Launch rdk using Robolink without printing rdk logs on stdout-cso_juan-12-16-2022

I try to launch RoboDK like this:
rdk = robolink.Robolink(close_std_out=True)
but then my python console output is polluted by the robodk logs.

I can do the following to keep the robodk logs out of my console:
rdk = robolink.Robolink(args=["-DEBUG"],close_std_out=True)
station = rdk.AddFile(station_filepath) #this will fail



however, I can launch the station if I first create a new Robolink instance
rdk = robolink.Robolink(args=["-DEBUG"],close_std_out=True)
rdk = robolink.Robolink() # new instance
station = rdk.AddFile(station_filepath) # now this works

my setup:
robodk python API version: 5.5.0
robodk version: v5.5.0
Ubuntu 20.04.5 LTS


RE: [BUG] Launch rdk using Robolink without printing rdk logs on stdout-Albert-12-20-2022

You can pass a file to save your debug output in a file instead of having it through the stdout pipe. You can do so by specifying the path to the text file like this:
Code:
rdk = robolink.Robolink(args=["-DEBUG=./path-to-file.txt"],close_std_out=True)
Thepath-to-file.txtshould be relative to the RoboDK executable/binary.

Alternatively, you can also customize the "output_reader" function in the Robolink module to customize the way the output is provided:
https://github.com/RoboDK/RoboDK-API/blob/master/Python/robodk/robolink.py#L1289

Or feel free to suggest changes to the initalization of the Robolink module and we can make them official.