Pdflatex - Permission denied: .\out.tex

Hallo,

So I have this Problem. I try to create a Tex-file in Ruby.
I have content which is saved within $doc. This content should be
written in a tex-file, which is meant to be created by pdflatex

My Code:

start = Document.new
start.chooseDocGeneralType
start.checkForFiles
@outfileName = “out.tex”
outfile = File.open(@outfileName, “w”)

$doc.createTitlePage
$doc.createContent
outfile.write $doc.text()
system “pdflatex #{@outfileName}”

#######################################################################

When I execute it, I get the exception:
Sorry, but pdflatex did not succeed.
The log-file hopefully contains the information.

When i look into the log file, it says:
pdflatex - Permission denied: .\out.tex

I dont get what the Problem is. out.tex is perfectly created. When I
open the file in TeXworks it creates the PDF without a problem. and even
when I make the command in cmd “pdflatex out.tex” it creates it
perfectly. But not within my Ruby Code.

Thank you very much,
Madita

I don’t think this is a Ruby-related question. The error message occurs
during the execution of the ‘system’ command, right? So the message
doesn’t come from Ruby.

I guess you already verified that the error does NOT occur, when you
enter the command from your shell. If this is the case, it might be that
the shell changes something (for the working case), such as providing a
cover function ‘pdflatex’ etc. Ruby optimizes away the invocation of
the shell, if the arguments to ‘system’ are “sufficiently simple”.

If you suspect that this could be related to your error message, you
could try to explicitly invoke the shell. For example, if your shell is
bash, you could do something like

system('bash','-c',"pdflatex #{@outfileName}")

and see whether it behaves differently.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs