Closed hidjis closed 6 years ago
This issue is not related with plumber. It is isolated to RcppTOML
.
Thank you for the files. I was able to reproduce your error without loading RcppTOML
. RcppTOML
has issues loading files that are saved with CRLF line endings. It worked fine for my when I changed them back to LF line endings.
# save lf file
cat('[database]\nhost = "0.0.0.0"\nuser = "toto"', file = "test_lf.toml")
# save crlf file
cat('[database]\r\nhost = "0.0.0.0"\r\nuser = "toto"', file = "test_crlf.toml")
RcppTOML::parseToml("test_lf.toml")
#> List of 1
#> $ database:List of 2
#> ..$ host: chr "0.0.0.0"
#> ..$ user: chr "toto"
RcppTOML::parseToml("test_crlf.toml")
#> Error in tomlparseImpl(path.expand(input), verbose, fromFile): Unidentified trailing character '
'---did you forget a '#'? at line 1
Created on 2018-08-14 by the reprex package (v0.2.0).
Thank you for your prompt response.
Just out of curiosity, do you have an explanation on why the result of RcppTOML::parseToml
changes after using plumber. I used the test_lf.toml and I still get an error only after calling plumber.
> # save lf file
> cat('[database]\nhost = "0.0.0.0"\nuser = "toto"', file = "test_lf.toml")
> # call RcppTOML the first time before plumber
> RcppTOML::parseToml("test_lf.toml")
List of 1
$ database:List of 2
..$ host: chr "0.0.0.0"
..$ user: chr "toto"
> # call plumber
> plumber::plumb("example.R")$run()
Starting server to listen on port 5389
Running the swagger UI at http://127.0.0.1:5389/__swagger__/
> # call RcppTOML the second time after plumber
> RcppTOML::parseToml("test_lf.toml")
Error in tomlparseImpl(path.expand(input), verbose, fromFile) :
'---did you forget a '#'? at line 1
This behavior happened only on windows. In linux, I can parse test_lf with no errors before and after calling plumber.
Sorry, I do not know.
I can reproduce your error. The tmp.toml
file is not touched in any way. If you restart R after achieving the error, the error goes away until run the server object.
Since there is no Rcpp code in plumber, I'm going to redirect this issue to the RcppTOML repo.
Thank you for your reply and the time you devoted on this issue.
With a restarted console, I can parse the following TOML file (tmp.toml) with no errors:
Then, I can start plumber with the following simple example:
But, if I stop the API, and try to parse again the toml file, I get the following error:
Any idea, why it's causing an error after calling plumber ? It looks like
plumber
is loadingRcppTOML
and changing its behavior.This is my sessionInfo at the beginning:
And at the end.
files.zip