Dear All,
I am using R 4.6, and i run the following code
reticulate::use_python(reticulate::install_python())
reticulate::py_require(c("kaleido", "plotly"))
p <- plot_ly(x = 1:10)
tmp <- tempfile(fileext = ".png")
save_image(p, tmp)
I get the following error
Error in py_run_string_impl(code, local, convert) :
File "<string>", line 1
import json; fig = json.load(open('C:\Users\310677\AppData\Local\Temp\Rtmpq0iC7T\filec73864b9a23.json'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
Run `reticulate::py_last_error()` for details.
then i run r reticulate::py_last_error()
reticulate::py_last_error() ── Python Exception Message ─────────────────────────────────────────────────────────────────────────────── File "", line 1 import json; fig = json.load(open('C:\Users\310677\AppData\Local\Temp\Rtmpq0iC7T\filec73864b9a23.json')) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape ── R Traceback ──────────────────────────────────────────────────────────────────────────────────────────── ▆ 1. └─plotly::save_image(p, tmp) 2. └─kaleido()$transform(...) 3. └─reticulate::py_run_string(load_json) 4. └─reticulate:::py_run_string_impl(code, local, convert) See `reticulate::py_last_error()$r_trace$full_call` for more details.
--
> | >
>
Please advise.
Dear All,
I am using R 4.6, and i run the following code
I get the following error
then i run
reticulate::py_last_error() ── Python Exception Message ─────────────────────────────────────────────────────────────────────────────── File "", line 1 import json; fig = json.load(open('C:\Users\310677\AppData\Local\Temp\Rtmpq0iC7T\filec73864b9a23.json')) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape ── R Traceback ──────────────────────────────────────────────────────────────────────────────────────────── ▆ 1. └─plotly::save_image(p, tmp) 2. └─kaleido()$transform(...) 3. └─reticulate::py_run_string(load_json) 4. └─reticulate:::py_run_string_impl(code, local, convert) See `reticulate::py_last_error()$r_trace$full_call` for more details. -- > | > >r reticulate::py_last_error()Please advise.