Debugging Applications #849
JennaSys
started this conversation in
Tips & Tricks
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Debugging browser applications is a little different than debugging a Python program in your favorite IDE. There are two main ways I have been debugging in the web browser when trying to understand what is going on in my program at a given time:
print()
statement to show current valuesWhen you transpile Python code that has
print()
statements with Transcrypt, by default, it essentially turns them intoconsole.log()
statements in JavaScript that will send the output of theprint()
statements to the developer console in the web browser. But if you have been using Transcrypt for any length of time you probably already know this. So the trick here, is that if you create an HTML DIV element in your HTML code and set theid
attribute of that DIV to "terminal", it will redirect that console output of theprint()
statements to the InnerHTML of that DIV element instead.This lets you see the output of the
print()
statements right in the application without having to open up the developer console in the web browser. There is some demonstration code of this somewhat obscure feature of Transcrypt in the documentation that give you an idea of how it can be used.Beta Was this translation helpful? Give feedback.
All reactions