SCM

Forum: support

Monitor Forum | Start New Thread Start New Thread
RE: python error messages in exams [ Reply ]
By: Markus Loecher on 2024-04-24 11:58
[forum:49882]
Thanks again! While I do have the latest version, just restarting my R session solved this "bug", how strange.
I should not have used the forum for this strange behaviour.

Thx



RE: python error messages in exams [ Reply ]
By: Achim Zeileis on 2024-04-24 10:50
[forum:49881]
That sounds strange. I would recommend to re-install the exams package to make sure you have the right version.

I tried:

library("exams")
set.seed(0)
exams2moodle("tstat.Rmd", n = 4)

And this gives me:

1. mu_0 = 125, t = -14.843
2. mu_0 = 500, t = 6.291
3. mu_0 = 1000, t = 26.6
4. mu_0 = 500, t = -23.255

RE: python error messages in exams [ Reply ]
By: Markus Loecher on 2024-04-24 10:26
[forum:49880]
Thanks again.
I rewrote the entire Rmd file into R only, and it works now.
Will figure out the environment later.

Strangely, the randomization in exams2moodle(...,n=40) does not seem to work. All 40 copies are identical.
I then tried the more basic
exams2moodle("tstat.Rmd", n = 4)
and even here, the 4 tests are the same.

Am I misinterpreting the n argument ?

RE: python error messages in exams [ Reply ]
By: Achim Zeileis on 2024-04-23 22:09
[forum:49879]
I'm not surprised that the three ways yield the same problem because knitr::knit is what is ultimately called in all three cases.

My guess would be a problem with the virtual environment. Maybe you need to add some use_virtualenv(...)?

I would try both of the following things:

(1) Strip away any real Python content and just keep some trivial computation, say "1 + 1" or something like that. And then check whether this still has the same problems or not. If it has, there must be a more fundamental problem. But if that removes the problem, then maybe the virtual environment might be the problem.

(2) Remove all echo = FALSE, results = "hide" chunk options and then only run xweave() and inspect the resulting .md file. Maybe this shows some warnings/errors/etc. that gives you a clue about what the source of the problems is.

RE: python error messages in exams [ Reply ]
By: Markus Loecher on 2024-04-23 17:13
[forum:49878]
Many thanks for the quick answer! Strange that it works for you while I get the error message in all three ways of rendering

Error in `as.vector()`:
! cannot coerce type 'environment' to vector of type 'list'

The resulting .md file has <pointer: 0x0> wherever there should be values.
None of these problems occur when I just knit.

RE: python error messages in exams [ Reply ]
By: Achim Zeileis on 2024-04-23 13:41
[forum:49877]
For me exams2html() runs ok. There is just one warning message:

In file.remove(sfile) :
cannot remove file 'raw.githubusercontent.com', reason 'Directory not empty'

but the resulting HTML file looks reasonable.

To debug you can try to run exams::xweave(...) on the .Rmd file. The output should be a standard .md file that can be easily processed by pandoc.

Moreover you can try to call knitr::knit(...) directly which is what exams::xweave(...) does internally.

python error messages in exams [ Reply ]
By: Markus Loecher on 2024-04-23 13:04
[forum:49876]

Test1.Rmd (4) downloads
The attached Rmd file (which mixes python and R) compiles fine with knitr but throws several error messages when compiling with exams2html(). Even when I load the diabetes data from a local file.
I wished I knew how to debug.
Any pointer would be immensely helpful.
Thx

Thanks to:
Vienna University of Economics and Business Powered By FusionForge