-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Debugging ? #49
Comments
It's been awhile since I've used it, but I think you can use the JavaScript |
Thanks, I'll give it a try. Been using print debugging (or in this case, log debugging) for too long. :) Anyone know how to generate source maps with pscript? Some transpilers generate source maps so that errors indicate the line in the original python code instead of a line in the javascript code. Would be very handy if pscript supports that. Thanks. |
Yeah, at the moment you'll have to debug the JavaScript that has been generated and then figure out how to update your Python code. This can be a painful task, I know. Source maps would be great, but PScript does not produce these. They would not fully solve the problem, because there's still several JS gotcha's to take into account, but at least it would make it easier what Python code is failing. |
No worries Almar. It's going quite well, actually. Very nice that pscript preserves the python method names. Easy to see the call chain where things went wrong. Having short methods helps too. :) By contrast, brython reproduces python runtime errors almost exactly - yet can still be very difficult to debug. Because the parser emits pages and pages of unintelligible javascript class errors on bad syntax. It can be a real pain finding that one misplaced ] in a long file. More than once I've had to resort to binary search debugging: comment out half the code, see if the error occurs, comment out half the remaining code, repeat ad nauseum. :) |
This is our punishment for trying to run Python instead of JavaScript in a browser :) |
Hey guys, great project! I'm impressed by how clean and syntax-complete this is. Several other python-to-js solutions are a pain to use or break python syntax in unexpected ways.
Question (since I don't see a discussion board or mailing list):
How can I debug pscript programs? Running the compiled js gives error messages in the console that don't relate to my python code at all. Is there some magic trick to get python line numbers in error messages? Any other suggestions for how to debug? Running in cpython only goes so far, the browser / DOM data don't exist there.
Thanks, best wishes.
The text was updated successfully, but these errors were encountered: