Search code examples
rr-exams

sh permission denied in exams2pdf


I use R/exams to generate a PDF exam like this:

exams2pdf("swisscapital")

However, this results in the following error:

Loading required namespace: tinytex
sh: : Permission denied

Doing the same with exams2html() works well.

What is the problem and how can I fix it?


Solution

  • Given that this does not produce an "error" within R but only on the shell (sh), this is probably just a problem of displaying the PDF interactively at the very end. You can check whether

    getOption("pdfviewer")
    

    is correctly set to an application for viewing PDFs (e.g., "/usr/bin/evince") and whether you have permission to use that application.

    If there are problems with getting a proper PDF viewer called from within R, then simply use

    exams2pdf("swisscapital", dir = ".")
    

    which will write the PDF to your current working directory rather than displaying it in the PDF viewer. And then you can manually open the PDF outside of R.