Skip to content
\n

to call an arbitrary Python string within Rust.

\n

Example usage:

\n
run_py(\"print('hi')\", \"main.py\");
\n

How can I print the traceback when the program fails? There is no apparent way to turn a traceback to a rust string.

","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"

Figured it out! I iterated over e.args().to_vec() and called .str().unwrap().to_string() on all of them to see all the traceback messages.

","upvoteCount":1,"url":"https://github.com/RustPython/RustPython/discussions/4395#discussioncomment-4564144"}}}
Discussion options

You must be logged in to vote

Figured it out! I iterated over e.args().to_vec() and called .str().unwrap().to_string() on all of them to see all the traceback messages.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by DimitrisJim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant
Converted from issue

This discussion was converted from issue #4393 on January 01, 2023 08:43.