How to get window manager reports from python (without reports_to_text operator since it was removed)?

Hi,

Our artists fell in love with the CommandRecorder addon (https://github.com/Muthird/CommandRecorder2.8) but it does not work in version 2.81.

I’m trying to solve the issue, but after a quick investigation I noticed the addon depends on the operator bpy.ops.ui.reports_to_textblock that was removed from 2.81 (https://developer.blender.org/D5510).

From what I understand, this operator was added to be able to see the list of info reports, which can now be seen in the “Info” editor and copy-paste, so the operator is no longer required from a user point of view.

So my question is: can I get reports from another way ? I saw in in D5510 that the operator was basically exposing the result of CTX_wm_reports through a Text in the blender file. Is there a ways to access this from the API ?

This also leads me to a more general question: how stable and reliable is the bpy.ops.* API ? If a given operator can disapear from one minor version to another, it seems to me that addons should avoid calling them.

1 Like

Hmm… when I was doing something similar in pre-2.80 Blender, I wasn’t aware of bpy.ops.ui.reports_to_textblock. My solution was to temporarily switch current area’s type to ‘INFO’ and use bpy.ops.info.* operators + window_manager.clipboard to select the reports and copy them to system clipboard.
I don’t know for certain if this trick still works, but it’s worth trying, I guess :slight_smile:

Seems hacky haha, it might work I guess but I think it would be better to just expose the result of CTX_wm_reports through the python API (in a function bpy.context.window_manager.reports() maybe ?).

Since there has been no other answer than yours it probably does not exist yet so I will implement that and try to fix the addon with it. I’ll send a revision to see how people react. I don’t really know the policy regarding the python API, if it is meant to remain stable and minimal or if additions to it are welcome.

depends on the nature of the update, if you change something that could break hundreds of Addons out in the wild you might get some pushback. If it’s something new, it’s less of an issue.

For people interested, I’ve built a Blender 2.82a that support the CommandRecorder addon (on Windows). You can find it here: https://drive.google.com/open?id=1rQTdtRK4uggIo4zyRhhQl8nNHF7le7Yc together with a git diff if you want to build it yourself. More information in the file README.md of the folder.

EDIT: Ok someone was clever and found a way to fix the addon directly for Blender 2.81+ by not relying on the report_to_text operator, you can find its repository here: https://github.com/RivinHD/CommandRecorder2.8