Can't see system.perspective.print messages

I’m trying to see these messages printed in a client run from a browser (tried Chrome and Edge Chromium) but I can’t find the messages. My script generates 3 print statements, and all I see in the browser console is:
image

If I click on the link, it goes to less than useful js code :confused:

How do I see the actual messages its outputting?

Can you show your code?

What you see in your screenshot is the result of the following call:

system.perspective.print('Start')
system.perspective.print('Start')
system.perspective.print('Start')

OR just a single line of that but invoked during three different Events.

The JS code link is because the console print is being performed by browser-side JS. You’re seeing the entirety of your message. If you’re expecting something else, then your message is not configured/formatted correctly. There is no error here, nor is there any bug from what I can see. Without insight into the script for clarity on what you’re trying to print, I can’t help any further.

An important point of clarification - unlike Python’s builtin print statement/function, system.perspective.print only accepts (and prints) one argument. You can’t just rely on varargs to send a whole list of things to print that will be automatically delimiter separated.

I think the actual issue I am having here is that my script simply isn’t getting through the rest of the code… The spaghetti monster knows why but he’s not talking to me. I do have a call to print at the top with ‘Start’ and I have 3 different calls to print in the script. I guess I incorrectly associated those console print statements with the 3 print statements in my script, but perhaps it’s just the script firing 3 times and failing to get through the rest of it 3 times… It’s doing my head in

3 Likes

Um, try-except clauses around the whole thing? With logging? (Use my PythonAsJavaException class to get python backtraces into your logs.)

You can if you use a tuple!

var1 = 'one'
var2 = 2
var3 = 3.0
system.perspective.print((var1, var2, var3))  # NB the args are in a tuple!

It's kind of a cheat, but handy if you're inserting temp debugging to print a bunch of variables.

HTH.
-Shane

1 Like

Also there are some contexts (Timer() threads, etc.) where you don't have access to the perspective session.