0

I am using a plugin in sublime text called Sidebar Enhancements.

One of its functionality has some issue. So i added few print statements in the source code of the plugin

I am not able to see the print statements output in the console which I have put in the source code

Example something like this i changed the source code to.

class SideBarFilesOpenWithCommand(sublime_plugin.WindowCommand):
 def run(self, paths=[], application="", extensions="", args=[], multiple=False):
 print("Hello World")

I am expecting the Hello World to appear in the console (ctrl + `)

i.e

enter image description here

MattDMo
103k21 gold badges251 silver badges239 bronze badges
asked Jun 4, 2023 at 3:27
3
  • How are you executing this? A WindowCommand won't just run on its own, it needs to be triggered somehow. Where did you put this code? Also, your image is completely blurred out, making it entirely useless. Commented Jun 5, 2023 at 17:40
  • in the image i want to show that i want the ouput at the console. Commented Jun 6, 2023 at 4:13
  • That's great, but why did you blur everything out? It's not even clear that the image is of Sublime Text. But besides that, my other two questions are much more important. Where did you put the code in your question, and how are you executing it? Commented Jun 6, 2023 at 17:19

1 Answer 1

0

print() does go to console. I briefly thought it wasn't (which lead to some searching and finding this post) but I think my issue was an async callback, user error, or some other bit of computer nonsense that I haven't reproduced.

Make sure you don't accidentally have multiple copies of the code. You can add top level prints to ensure the file you are changing is the right file.

I made a demo using Tools > Developer > New Plugin... and saved it as delete.py,

import sublime_plugin
print('This plugin has been loaded.')
class DemoSideBarFilesOpenWithCommand(sublime_plugin.WindowCommand):
 def run(self, paths=[], application="", extensions="", args=[], multiple=False):
 print("Hello World, I am working!")

Then ran it in the console window.run_command('demo_side_bar_files_open_with')

You can see after "reloading plugin User.delete" has the print, so I know I have the right file, and that calling the command works. You might also need to restart sublime, there could be some code caching issue, I don't know if user plugins are treated differently than other ones. Even this, though, could hide something, maybe I saved it to the wrong folder, but it has much more info than blurring out most of the image.

I'd also recommend making a little demo so you don't need to blur as much for privacy, or whatever other concerns you have. I get that you were trying to be clear where you expected the print to be but there might be some hint that gets covered up.

For this screenshot I pulled off the tab then just covered up most of the filename as an example.

Good luck sleuthing!

Example sublime plugin printing to console

answered Dec 29, 2023 at 21:40
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.