ministryofjustice / analytics-platform

Parent repository for the MOJ Analytics Platform
MIT License
14 stars 1 forks source link

R markdown reference docx failure #6

Closed ChrisFairbanks closed 7 years ago

ChrisFairbanks commented 7 years ago

What happened?

I am trying to reference a styles document in R markdown and I recieve the following error message:

pandoc: Data.Binary.Get.runGet at position 4: Did not find end of central directory signature Error: pandoc document conversion failed with error 1 Execution halted

Steps to reproduce the problem

I can reproduce the steps by running the following markdown code:


title: "OMSQv1" author: "Christopher Fairbanks" date: "17/08/2017" output: word_document: reference_docx: mystyles.docx

Expected behaviour

The code is supposed to create a word document with styling base on the mystyles.docx

ChrisFairbanks commented 7 years ago

I have used multiple .docx files, including a blank document with no styles

RobinL commented 7 years ago

Thanks, could you run the following code and paste the response here:

ip <- as.data.frame(installed.packages()[,c(1,3:4)])
rownames(ip) <- NULL
ip <- ip[is.na(ip$Priority),1:2,drop=FALSE]
print(ip, row.names=FALSE)

and also

sessionInfo()
ChrisFairbanks commented 7 years ago

For the first: Package Version assertr 2.0.2.2 assertthat 0.2.0 aws.s3 0.3.7 aws.signature 0.3.6 backports 1.1.0 base64enc 0.1-3 BH 1.62.0-1 bindr 0.1 bindrcpp 0.2 bitops 1.0-6 brew 1.0-6 callr 1.0.0.9000 caTools 1.17.1 cellranger 1.1.0 clisymbols 1.2.0 colorspace 1.3-2 commonmark 1.2 crayon 1.3.2 curl 2.8.1 debugme 1.0.2 desc 1.1.1 devtools 1.13.3.9000 dichromat 2.0-0 digest 0.6.12 dplyr 0.7.2 DT 0.2 eesectors 0.1.0 evaluate 0.10.1 feather 0.3.1 forcats 0.2.0 gdata 2.18.0 ggplot2 2.2.1 gh 1.0.1 git2r 0.19.0 glue 1.1.1 govstyle 0.1.2 gtable 0.2.0 gtools 3.5.0 haven 1.1.0 highr 0.6 hms 0.3 htmltools 0.3.6 htmlwidgets 0.8 httr 1.2.1 ini 0.2 jsonlite 1.5 knitr 1.16 labeling 0.3 lazyeval 0.2.0 magrittr 1.5 markdown 0.8 memoise 1.1.0 mime 0.5 miniUI 0.1.1 mojmar 0.1.0 munsell 0.4.3 openssl 0.9.6 pkgbuild 0.0.0.9000 pkgconfig 2.0.1 pkgload 0.0.0.9000 plogr 0.1-1 plyr 1.8.4 png 0.1-7 praise 1.0.0 processx 2.0.1.9001 purrr 0.2.3 R6 2.2.2 RColorBrewer 1.1-2 Rcpp 0.12.12 readr 1.1.1 readxl 1.0.0 rematch 1.0.1 reshape2 1.4.2 rlang 0.1.2.9000 rmarkdown 1.6 roxygen2 6.0.1 rprojroot 1.2 rstudioapi 0.6 s3browser 0.1.0 s3tools 0.0.0.9000 scales 0.4.1 sessioninfo 1.0.0 statspicker 0.0.0.9003 stringi 1.1.5 stringr 1.2.0 testthat 1.0.2.9000 tibble 1.3.3 tidyr 0.6.3 usethis 0.0.0.9000 visualTest 1.0.0 whisker 0.3-2 withr 2.0.0 xml2 1.1.1 xtable 1.8-2 yaml 2.1.14 assertthat 0.2.0 aws.ec2metadata 0.1.3 aws.s3 0.3.7 aws.signature 0.3.6 backports 1.1.0 base64enc 0.1-3 BH 1.62.0-1 bindr 0.1 bindrcpp 0.2 bitops 1.0-6 broom 0.4.2 caTools 1.17.1 cellranger 1.1.0 colorspace 1.3-2 curl 2.8.1 devtools 1.13.3 dichromat 2.0-0 digest 0.6.12 docopt 0.4.5 dplyr 0.7.2 DT 0.2 evaluate 0.10.1 feather 0.3.1 forcats 0.2.0 formatR 1.5 gdata 2.18.0 ggplot2 2.2.1 git2r 0.19.0 glue 1.1.1 gtable 0.2.0 gtools 3.5.0 haven 1.1.0 highr 0.6 hms 0.3 htmltools 0.3.6 htmlwidgets 0.9 httpuv 1.3.5 httr 1.2.1 jsonlite 1.5 knitr 1.17 labeling 0.3 lazyeval 0.2.0 littler 0.3.2 lubridate 1.6.0 magrittr 1.5 markdown 0.8 memoise 1.1.0 mime 0.5 miniUI 0.1.1 mnormt 1.5-5 modelr 0.1.1 munsell 0.4.3 openssl 0.9.6 pkgconfig 2.0.1 plogr 0.1-1 plyr 1.8.4 psych 1.7.5 purrr 0.2.3 R6 2.2.2 RColorBrewer 1.1-2 Rcpp 0.12.12 readr 1.1.1 readxl 1.0.0 rematch 1.0.1 reshape2 1.4.2 rlang 0.1.2 rmarkdown 1.6 rprojroot 1.2 rstudioapi 0.6 rvest 0.3.2 s3browser 0.1.1 s3tools 0.0.0.9000 scales 0.4.1 selectr 0.3-1 shiny 1.0.3 sourcetools 0.1.6 stringi 1.1.5 stringr 1.2.0 tibble 1.3.3 tidyr 0.6.3 tidyverse 1.1.1 webshot 0.4.1 whisker 0.3-2 withr 2.0.0 xml2 1.1.1 xtable 1.8-2 yaml 2.1.14

ChrisFairbanks commented 7 years ago

And the second: R version 3.4.1 (2017-06-30) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Debian GNU/Linux 9 (stretch)

Matrix products: default BLAS: /usr/lib/openblas-base/libblas.so.3 LAPACK: /usr/lib/libopenblasp-r0.2.19.so

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

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

other attached packages: [1] plyr_1.8.4

loaded via a namespace (and not attached): [1] compiler_3.4.1 tools_3.4.1 Rcpp_0.12.12

RobinL commented 7 years ago

We had a similar error today in a training session:

output file: Crime_Stats.knit.md

pandoc: Data.Binary.Get.runGet at position 4: Did not find end of central directory signature
Error: pandoc document conversion failed with error 1
Execution halted

When we downloaded the .docx to platform via Github or via s3 everything is fine. So it looks like a bug with the file uploader, whereby the .docx gets corrupted.

andyhd commented 7 years ago

I could not reproduce the issue. I uploaded a mystyles.docx file to my RStudio instance, created a Rmarkdown file with output: word_document and reference_docx: mystyles.docx and used Knit to create a new .docx file with the styles.

Is this still a problem for you?

RobinL commented 7 years ago

@andyhd i think this could be related to the file upload bug.

andyhd commented 7 years ago

Yes, although I was able to create a .docx file, I realised the mystyles.docx file is corrupt

andyhd commented 7 years ago

@RobinL confirmed that the file upload bug fix also fixes this bug