Hello Folks,

When I run the document below through sweave, rgui.exe/rsession.exe
leaves a file handle open to the sweave-001.pdf graphic (as verified by
process explorer).  Pdflatex.exe then crashes (with a Permission Denied
error) because the graphic file is locked.

This only seems to happen when there is an error in the sweave document.
 When there are no errors, no file handles are left open.  However, once
a file handle is stuck open, I can find no other way of closing it save
for quitting out of R.

Any help would be greatly appreciated!  It would be nice to be able to
write flawless sweave every time, but flawed as I am, I am having to
restart R continuously.

Thanks,
Allie


OS: Windows 7 Pro x64 SP1


> sessionInfo()
R version 2.14.2 (2012-02-29)
Platform: i386-pc-mingw32/i386 (32-bit)


test.Rnw:

    \documentclass{article}
    \title {file handle test}
    \author{test author}
    \usepackage{Sweave}
    \begin {document}
    \maketitle

    \SweaveOpts{prefix.string=sweave}

    \begin{figure}
    \begin{center}

    <<fig=TRUE, echo=FALSE>>=
        df = data.frame(a=rnorm(100), b=rnorm(100), group = c("g1",
"g2", "g3", "g4"))
        plot(df$a, df$y, foo)
    @

    \caption{test figure one}
    \label{fig:one}
    \end{center}
    \end{figure}
    \end{document}



Sweave command run:

    Sweave("test.Rnw", syntax="SweaveSyntaxNoweb")



Sweave.sty:

    \NeedsTeXFormat{LaTeX2e}
    \ProvidesPackage{Sweave}{}

    \RequirePackage{ifthen}
    \newboolean{Sweave@gin}
    \setboolean{Sweave@gin}{true}
    \newboolean{Sweave@ae}
    \setboolean{Sweave@ae}{true}

    \DeclareOption{nogin}{\setboolean{Sweave@gin}{false}}
    \DeclareOption{noae}{\setboolean{Sweave@ae}{false}}
    \ProcessOptions

    \RequirePackage{graphicx,fancyvrb}
    \IfFileExists{upquote.sty}{\RequirePackage{upquote}}{}

    \ifthenelse{\boolean{Sweave@gin}}{\setkeys{Gin}{width=0.8\textwidth}}{}%
    \ifthenelse{\boolean{Sweave@ae}}{%
      \RequirePackage[T1]{fontenc}
      \RequirePackage{ae}
    }{}%

    \DefineVerbatimEnvironment{Sinput}{Verbatim}{fontshape=sl}
    \DefineVerbatimEnvironment{Soutput}{Verbatim}{}
    \DefineVerbatimEnvironment{Scode}{Verbatim}{fontshape=sl}

    \newenvironment{Schunk}{}{}

    \newcommand{\Sconcordance}[1]{%
      \ifx\pdfoutput\undefined%
      \csname newcount\endcsname\pdfoutput\fi%
      \ifcase\pdfoutput\special{#1}%
      \else\immediate\pdfobj{#1}\fi}

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to