cboettig/knitcitations

Error in ReadBib

Closed this issue · 4 comments

When calling citep with a DOI either at the prompt or when knitting, I get the following error:

Error in ReadBib(con) : unprotect_ptr: pointer not found
Calls: <Anonymous> ... FUN -> bib_metadata -> greycite -> ReadBib -> .External
Execution halted

Session info:

> sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-redhat-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] knitcitations_1.0-2 scales_0.2.4        knitr_1.6           plyr_1.8.1          ggplot2_1.0.0       reshape_0.8.5       ddCt_1.18.0         lattice_0.20-29    
 [9] xtable_1.7-3        RColorBrewer_1.0-5  Biobase_2.24.0      BiocGenerics_0.10.0

loaded via a namespace (and not attached):
 [1] bibtex_0.3-6     colorspace_1.2-4 digest_0.6.4     evaluate_0.5.5   formatR_0.10     grid_3.1.0       gtable_0.1.2     htmltools_0.2.4  httr_0.3         lubridate_1.3.3 
[11] MASS_7.3-33      memoise_0.2.1    munsell_0.4.2    proto_0.3-10     Rcpp_0.11.2      RCurl_1.95-4.1   RefManageR_0.8.2 reshape2_1.4     RJSONIO_1.2-0.2  rmarkdown_0.2.49
[21] stringr_0.6.2    tools_3.1.0      XML_3.98-1.1     yaml_2.1.13     

Strange, your sessionInfo versions look correct and I cannot reproduce your
error. Can you provide an example call?
Did you try the queries from the readme?

From the error trace it looks like your query is getting interpreted as a
regular URL instead of a doi (since it is calling greycite instead of
ReadCrossRef)


Carl Boettiger
http://carlboettiger.info

sent from mobile device; my apologies for any terseness or typos
On Jul 2, 2014 9:37 PM, "Kenneth Daily" notifications@github.com wrote:

When calling citep with a DOI either at the prompt or when knitting, I
get the following error:

Error in ReadBib(con) : unprotect_ptr: pointer not found
Calls: ... FUN -> bib_metadata -> greycite -> ReadBib -> .External
Execution halted

Session info:

sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-redhat-linux-gnu (64-bit)

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base

other attached packages:
[1] knitcitations_1.0-2 scales_0.2.4 knitr_1.6 plyr_1.8.1 ggplot2_1.0.0 reshape_0.8.5 ddCt_1.18.0 lattice_0.20-29
[9] xtable_1.7-3 RColorBrewer_1.0-5 Biobase_2.24.0 BiocGenerics_0.10.0

loaded via a namespace (and not attached):
[1] bibtex_0.3-6 colorspace_1.2-4 digest_0.6.4 evaluate_0.5.5 formatR_0.10 grid_3.1.0 gtable_0.1.2 htmltools_0.2.4 httr_0.3 lubridate_1.3.3
[11] MASS_7.3-33 memoise_0.2.1 munsell_0.4.2 proto_0.3-10 Rcpp_0.11.2 RCurl_1.95-4.1 RefManageR_0.8.2 reshape2_1.4 RJSONIO_1.2-0.2 rmarkdown_0.2.49
[21] stringr_0.6.2 tools_3.1.0 XML_3.98-1.1 yaml_2.1.13


Reply to this email directly or view it on GitHub
#62.

Me to, and I tried queries from your own writing

session follows:

> library(knitcitations)
> citep(citation())
[1] "(R Core Team, 2014)"
> citep("http://cran.r-project.org/web/views/Phylogenetics.html")
Error in ReadBib(con) : unprotect_ptr: pointer not found
In addition: Warning message:
In ReadBib(con) :
/tmp/RtmpOs107h/greycite.bib28561b81fa4:59:0
    syntax error, unexpected $end
    Dropping the entry `(null)` (starting at line 0)
> sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_\
US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base

other attached packages:
[1] knitcitations_1.0-2

loaded via a namespace (and not attached):
 [1] bibtex_0.3-6      digest_0.6.4      httr_0.5          lubridate_1.3.3   memoise_0.2.1     plyr_1.8.1        Rcpp_0.11.3       RCurl_1.95-4.3    RefManageR_0.8.34 RJSONIO_1.3-\
0     stringr_0.6.2     tools_3.1.0       XML_3.98-1.1

a little sleuthing into that /tmp file finds that

...
There has been a GreyCite System Error ..
Exception - 1  Type : 1
Class 'http\URL' not found
/opt/httpd/htdocs/class/uri.php Line 17
...

here is he full document:

<!doctype html>
<!--[if lt IE 9]><html class="ie"><![endif]-->
<!--[if gte IE 9]><!--><html><!--<![endif]-->
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <title>GreyCite System Error</title>

    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta name="description" content="GreyCite"/>
<!--
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
-->

    <link rel="shortcut icon" href="images/favicon.png"/>
    <link rel="icon" type="image/gif" href="images/favicon.png"/>
<!--
    <link rel="apple-touch-icon" href="assets/ico/apple-touch-icon.png">
    <link rel="apple-touch-icon" sizes="72x72" href="assets/ico/apple-touch-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="114x114" href="assets/ico/apple-touch-icon-114x114.png">
-->

    <link rel="stylesheet" href="css/bootstrap.css" media="screen"/>

    <link rel="stylesheet" href="css/util.css"/>
    <link rel="stylesheet" href="css/emi.css" media="screen"/>
<!--
    <script src="https://ajax.cdnjs.com/ajax/libs/modernizr/1.7/modernizr-1.7.min.js"></script>
-->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
    <!--[if lt IE 9]>
    <script src="https://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
    <script src="https://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->


</head>
<body lang="en">
    <div class="container">
    <header class="row">
       <div class="span12">
        <h2 class="cntr">GreyCite</h2>
        </div>
    </header>
    <div class="row">
        <article>
           <div class="threecol">&nbsp;</div>
           <div class="sixcol last cntr">
            <p>There has been a GreyCite System Error</p>
                       </div>
        </article>
    </div>
    </div>
</body>
</html>
Exception - 1  Type : 1
Class 'http\URL' not found
/opt/httpd/htdocs/class/uri.php Line 17

Thanks for the bug reports; yes; it looks like the greycite API has been down for a couple days, so that queries of URLs fail. I've pushed a fix in 508de74, v1.0.4 to provide a bit more graceful error handling for this case, so knitcitations will simply create a bibtex entry with author and title "unknown" and produce a warning if the Greycite API is down.

I contacted the Greycite team and they say their system should be back up soon in any event. v1.0.4 should be on CRAN soon.

I think this is fixed as Greycite is back up.