Closed brry closed 5 months ago
error = TRUE
means to not let any error in the chunk to stop the knitting. (see doc at https://yihui.org/knitr/options/#text-output)
This is what I get in output
where I can see the error.
If set to FALSE then the error is thrown during knitting.
==> rmarkdown::render('C:/Users/chris/Documents/test.Rmd', encoding = 'UTF-8');
|....................................................| 100% [unnamed-chunk-1]
processing file: test.Rmd
Quitting from lines 9-11 [unnamed-chunk-1] (test.Rmd)
Error in `py_call_impl()`:
! ValueError: invalid literal for int() with base 10: 'charstring'
Run `reticulate::py_last_error()` for details.
Backtrace:
1. rmarkdown::render("C:/Users/chris/Documents/test.Rmd", encoding = "UTF-8")
2. knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
3. knitr:::process_file(text, output)
8. knitr:::process_group.block(group)
9. knitr:::call_block(x)
...
13. knitr (local) engine(options)
14. reticulate::eng_python(options)
15. reticulate:::py_compile_eval(snippet, compile_mode)
18. builtins$eval(compiled, globals, locals)
19. reticulate:::py_call_impl(callable, call_args$unnamed, call_args$named)
Exécution arrêtée
So I guess you want to see ! ValueError:
inside the document - is that right ?
This is using dev knitr and recent rmarkdown and reticulate packages
> packageVersion('reticulate')
[1] ‘1.34.0’
> packageVersion('knitr')
[1] ‘1.45.9’
> packageVersion('rmarkdown')
[1] ‘2.25’
You'll have to add backticks for the chunk, I couldn't get the markdown preview to be right.
BTW about this, you can read how to in the guide : https://yihui.org/issue/#please-format-your-issue-correctly
python engine is handled by reticulate so I wonder if something has changed in there error handling maybe 🤔
Thanks for the backtick reference - I somehow missed that section. I fixed that above now.
Yes, the idea is to see ValueError:
inside the document.
Oh, I should have thought of reticulate
- that is indeed where the change is.
Version 1.28 still contained ValueError, Version 1.29 no longer does that. I will investigate and (hopefully^^) solve the issue there.
In Rnw Python chunks, exception types are no longer included in the output. Last year, the example below showed
## ValueError: invalid literal for int() with base 10: 'charstring'
now, it only shows## invalid literal for int() with base 10: 'charstring'