Sublime Forum

Access console from python

#1

When trying to get a subst() from the console view I’m getting an empty output. Has anyone accessed console content with python API?

1 Like

How to get the console view? find_output_panel('console') returns None
#2

How do you determine this “console view”?

1 Like

#3

Sorry, I think I was using find_output_panel('console') but apparently this returns None.

1 Like

#4

The view associated to the build output can be obtained with window.find_output_panel("exec").

1 Like

#5

RIght, but I’d like to access console :slight_smile:

1 Like

#6

Whoops, brainfart. Sorry!

1 Like

#7

No worries, I doubt the console is supported at the moment… To give some background I’ve been trying to access logged commands as the current command_history in API is too limited.

1 Like

#8

why not just create a http://www.sublimetext.com/docs/3/api_reference.html#sublime_plugin.EventListener and listen for on_post_window_command and on_post_text_command and create your own log?
if you really need to access the console, your best bet is redirecting stdout.

1 Like

#9

Cheers, I’ll give it a shot.
Yup this was exactly I was looking for.
Again, many thanks for pointing that out!

1 Like