Giter Site home page Giter Site logo

msgxtractr's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

msgxtractr's Issues

Special character issue on windows

read_msg does not work for me on windows when there are special characters in the path. The same code works like expected on linux.

Have a look at the example below. In the path of the second mail there are special characters.

On Windows:

library(magrittr)
library(msgxtractr)

system.file("extdata/unicode.msg", package="msgxtractr") %>%
  file.copy(to = c("Copenhagen.msg", "København.msg"), overwrite = TRUE)
#> [1] TRUE TRUE

(mails <- list.files(pattern = "msg"))
#> [1] "Copenhagen.msg" "København.msg"

lapply(mails, read_msg)
#> [[1]]
#> Mon, 18 Nov 2013 10:26:24 +0200
#> From: Brian Zhou <[email protected]>
#> To: [email protected]
#> Subject: Test for TIF files
#> Attachments: 2
#> 
#> [[2]]
#> From: [Unspecified]
#> To: [Unspecified]
#> Subject: [Unspecified]

On Linux:

library(magrittr)
library(msgxtractr)

system.file("extdata/unicode.msg", package="msgxtractr") %>%
   file.copy(to = c("Copenhagen.msg", "København.msg"), overwrite = TRUE) 
#> [1] TRUE TRUE

(mails <- list.files(pattern = "msg"))
#> [1] "Copenhagen.msg" "København.msg"

lapply(mails, read_msg)
#> [[1]]
#> Mon, 18 Nov 2013 10:26:24 +0200
#> From: Brian Zhou <[email protected]>
#> To: [email protected]
#> Subject: Test for TIF files
#> Attachments: 2
#>
#> [[2]]
#> Mon, 18 Nov 2013 10:26:24 +0200
#> From: Brian Zhou <[email protected]>
#> To: [email protected]
#> Subject: Test for TIF files
#> Attachments: 2

compilation failed for package 'msgxtractr'

Hi,
I am newbie in R and trying to download "msgxtractr", but fails. What I am doing wrong. please help.

devtools::install_github("hrbrmstr/msgxtractr")
Downloading GitHub repo hrbrmstr/msgxtractr@master
from URL https://api.github.com/repos/hrbrmstr/msgxtractr/zipball/master
WARNING: Rtools is required to build R packages, but no version of Rtools compatible with R 3.5.0 was found. (Only the following incompatible version(s) of Rtools were found:3.4,3.5)

Please download and install the appropriate version of Rtools from http://cran.r-project.org/bin/windows/Rtools/.
Installing msgxtractr
"C:/PROGRA1/R/R-351.0/bin/x64/R"
--no-site-file --no-environ --no-save
--no-restore --quiet CMD INSTALL
"C:/Users/Ola/AppData/Local/Temp/RtmpkJqev2/devtools29f428457e70/hrbrmstr-msgxtractr-0e4db75"
--library="D:/Ola/Documents/R/win-library/3.5"
--install-tests

  • installing source package 'msgxtractr' ...
    ** libs

*** arch - i386
Warning in system(cmd) : 'make' not found
ERROR: compilation failed for package 'msgxtractr'

  • removing 'D:/Ola/Documents/R/win-library/3.5/msgxtractr'
    In R CMD INSTALL
    Installation failed: Command failed (1)

msgxtractr failes to build on Windows machine

Using R 3.5.1, devtools 2.0.0 - this command:
devtools::install_github("hrbrmstr/msgxtractr")
Results in the following error

Downloading GitHub repo hrbrmstr/msgxtractr@master
√  checking for file 'D:\Users\171776\AppData\Local\Temp\RtmpAlCRVC\remotes340c23805b54\hrbrmstr-msgxtractr-017d6c0/DESCRIPTION' ...
-  preparing 'msgxtractr':
√  checking DESCRIPTION meta-information ... 
-  cleaning src
-  checking for LF line-endings in source and make files and shell scripts
-  checking for empty or unneeded directories
-  building 'msgxtractr_0.2.1.tar.gz'
   
* installing *source* package 'msgxtractr' ...
** libs

*** arch - i386
C:/RBuildTools/3.4/mingw_32/bin/g++  -std=gnu++11 -I"D:/R-3.5.1/include" -DNDEBUG  -I"D:/R-3.5.1/library/Rcpp/include"        -O2 -Wall  -mtune=generic -c RcppExports.cpp -o RcppExports.o
C:/RBuildTools/3.4/mingw_32/bin/gcc  -I"D:/R-3.5.1/include" -DNDEBUG  -I"D:/R-3.5.1/library/Rcpp/include"        -O3 -Wall  -std=gnu99 -mtune=generic -c alloc.c -o alloc.o
C:/RBuildTools/3.4/mingw_32/bin/gcc  -I"D:/R-3.5.1/include" -DNDEBUG  -I"D:/R-3.5.1/library/Rcpp/include"        -O3 -Wall  -std=gnu99 -mtune=generic -c attr.c -o attr.o
C:/RBuildTools/3.4/mingw_32/bin/gcc  -I"D:/R-3.5.1/include" -DNDEBUG  -I"D:/R-3.5.1/library/Rcpp/include"        -O3 -Wall  -std=gnu99 -mtune=generic -c date.c -o date.o
C:/RBuildTools/3.4/mingw_32/bin/gcc  -I"D:/R-3.5.1/include" -DNDEBUG  -I"D:/R-3.5.1/library/Rcpp/include"        -O3 -Wall  -std=gnu99 -mtune=generic -c debug.c -o debug.o
C:/RBuildTools/3.4/mingw_32/bin/gcc  -I"D:/R-3.5.1/include" -DNDEBUG  -I"D:/R-3.5.1/library/Rcpp/include"        -O3 -Wall  -std=gnu99 -mtune=generic -c file.c -o file.o
file.c: In function 'file_write':
file.c:73:2: warning: implicit declaration of function 'strdup' [-Wimplicit-function-declaration]
  file->name = strdup( TNEF_DEFAULT_FILENAME );
  ^
file.c:73:15: warning: incompatible implicit declaration of built-in function 'strdup'
  file->name = strdup( TNEF_DEFAULT_FILENAME );
               ^
file.c:83:19: warning: incompatible implicit declaration of built-in function 'strdup'
      file->path = strdup( TNEF_DEFAULT_FILENAME );
                   ^
file.c:92:9: warning: incompatible implicit declaration of built-in function 'strdup'
  path = strdup( TNEF_DEFAULT_FILENAME );
         ^
file.c: In function 'file_add_mapi_attrs':
file.c:180:16: warning: incompatible implicit declaration of built-in function 'strdup'
   file->name = strdup( (char*)a->values[0].data.buf );
                ^
file.c: In function 'file_add_attr':
file.c:235:15: warning: incompatible implicit declaration of built-in function 'strdup'
  file->name = strdup( (char*)attr->buf );
               ^
C:/RBuildTools/3.4/mingw_32/bin/gcc  -I"D:/R-3.5.1/include" -DNDEBUG  -I"D:/R-3.5.1/library/Rcpp/include"        -O3 -Wall  -std=gnu99 -mtune=generic -c mapi_attr.c -o mapi_attr.o
C:/RBuildTools/3.4/mingw_32/bin/gcc  -I"D:/R-3.5.1/include" -DNDEBUG  -I"D:/R-3.5.1/library/Rcpp/include"        -O3 -Wall  -std=gnu99 -mtune=generic -c mapi_names.c -o mapi_names.o
C:/RBuildTools/3.4/mingw_32/bin/gcc  -I"D:/R-3.5.1/include" -DNDEBUG  -I"D:/R-3.5.1/library/Rcpp/include"        -O3 -Wall  -std=gnu99 -mtune=generic -c mapi_types.c -o mapi_types.o
C:/RBuildTools/3.4/mingw_32/bin/gcc  -I"D:/R-3.5.1/include" -DNDEBUG  -I"D:/R-3.5.1/library/Rcpp/include"        -O3 -Wall  -std=gnu99 -mtune=generic -c options.c -o options.o
C:/RBuildTools/3.4/mingw_32/bin/gcc  -I"D:/R-3.5.1/include" -DNDEBUG  -I"D:/R-3.5.1/library/Rcpp/include"        -O3 -Wall  -std=gnu99 -mtune=generic -c path.c -o path.o
path.c: In function 'could_be_a_windows_path':
path.c:148:5: warning: implicit declaration of function 'rindex' [-Wimplicit-function-declaration]
     up = rindex( fname, '\\' );
     ^
path.c:148:10: warning: incompatible implicit declaration of built-in function 'rindex'
     up = rindex( fname, '\\' );
          ^
path.c:164:2: warning: implicit declaration of function 'index' [-Wimplicit-function-declaration]
  if ( index( fname, (int)*up ) )
  ^
path.c:164:7: warning: incompatible implicit declaration of built-in function 'index'
  if ( index( fname, (int)*up ) )
       ^
path.c: In function 'munge_fname':
path.c:328:13: warning: incompatible implicit declaration of built-in function 'rindex'
      base = rindex( dir, (int)'\\' );
             ^
C:/RBuildTools/3.4/mingw_32/bin/g++  -std=gnu++11 -I"D:/R-3.5.1/include" -DNDEBUG  -I"D:/R-3.5.1/library/Rcpp/include"        -O2 -Wall  -mtune=generic -c pole.cpp -o pole.o
pole.cpp: In member function 'void POLE::DirTree::load(unsigned char*, unsigned int)':
pole.cpp:670:14: warning: variable 'prefix' set but not used [-Wunused-but-set-variable]
     unsigned prefix = 32;
              ^
C:/RBuildTools/3.4/mingw_32/bin/g++  -std=gnu++11 -I"D:/R-3.5.1/include" -DNDEBUG  -I"D:/R-3.5.1/library/Rcpp/include"        -O2 -Wall  -mtune=generic -c r_pole.cpp -o r_pole.o
In file included from r_pole.cpp:15:0:
util.h:36:8: error: 'uint32' does not name a type
 extern uint32 GETINT32(unsigned char*p);
        ^
util.h:37:8: error: 'uint16' does not name a type
 extern uint16 GETINT16(unsigned char*p);
        ^
util.h:38:8: error: 'uint8' does not name a type
 extern uint8 GETINT8(unsigned char*p);
        ^
util.h:41:8: error: 'uint32' does not name a type
 extern uint32 geti32(FILE *fp);
        ^
util.h:42:8: error: 'uint16' does not name a type
 extern uint16 geti16(FILE *fp);
        ^
util.h:43:8: error: 'uint8' does not name a type
 extern uint8 geti8(FILE *fp);
        ^
In file included from mapi_attr.h:35:0,
                 from rtf.h:32,
                 from r_pole.cpp:17:
mapi_types.h:30:19: warning: 'get_mapi_type_str' initialized and declared 'extern'
 get_mapi_type_str(uint16 d);
                   ^
mapi_types.h:30:19: error: 'uint16' was not declared in this scope
In file included from mapi_attr.h:36:0,
                 from rtf.h:32,
                 from r_pole.cpp:17:
mapi_names.h:440:19: warning: 'get_mapi_name_str' initialized and declared 'extern'
 get_mapi_name_str(uint16 d);
                   ^
mapi_names.h:440:19: error: 'uint16' was not declared in this scope
In file included from rtf.h:32:0,
                 from r_pole.cpp:17:
mapi_attr.h:43:5: error: 'uint32' does not name a type
     uint32 data1;
     ^
mapi_attr.h:44:5: error: 'uint16' does not name a type
     uint16 data2;
     ^
mapi_attr.h:45:5: error: 'uint16' does not name a type
     uint16 data3;
     ^
mapi_attr.h:46:5: error: 'uint8' does not name a type
     uint8 data4[8];
     ^
mapi_attr.h:55:2: error: 'uint16' does not name a type
  uint16 bytes2;
  ^
mapi_attr.h:56:2: error: 'uint32' does not name a type
  uint32 bytes4;
  ^
mapi_attr.h:57:2: error: 'uint32' does not name a type
  uint32 bytes8[2];
  ^
r_pole.cpp: In function 'Rcpp::RawVector decompress_rtf_data(unsigned char*, size_t, size_t)':
r_pole.cpp:92:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if ( cin+1 > lenc ) {
                ^
r_pole.cpp:107:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if ( cin+2 > lenc ){
                    ^
r_pole.cpp:125:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if ( cout+rlen > lenu ) {
                        ^
r_pole.cpp:142:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if ( cin+1 > lenc ) {
                    ^
r_pole.cpp:147:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if ( cout+1 > lenu ) {
                     ^
r_pole.cpp: In function 'Rcpp::RawVector decode_rtf(Rcpp::RawVector)':
r_pole.cpp:175:29: warning: unused variable 'rtf_uncompressed_magic' [-Wunused-variable]
   static const unsigned int rtf_uncompressed_magic = 0x414c454d;
                             ^
make: *** [r_pole.o] Error 1
ERROR: compilation failed for package 'msgxtractr'
* removing 'D:/R-3.5.1/library/msgxtractr'
In R CMD INSTALL
Error in i.p(...) : 
  (converted from warning) installation of package ‘D:/Users/171776/AppData/Local/Temp/RtmpAlCRVC/file340c5226161b/msgxtractr_0.2.1.tar.gz’ had non-zero exit status
In addition: Warning messages:
1: In untar2(tarfile, files, list, exdir) :
  skipping pax global extended headers
2: In untar2(tarfile, files, list, exdir) :
  skipping pax global extended headers

Encoding issues

Hello !

Thank you for this small and nice package.

Unfortunately I cannot run the read_msg fonction on my computer. I tried to run the README example and the error is the following :

Error in iconv(msg$body, from = "UTF-7") :
unsupported conversion from 'UTF-7' to '' in codepage 1252

It may be because UTF-7 is not in my "iconvlist()". I'm working on windows 10.

And as I said on twitter : I cannot read some of my e-mails with you example given here : http://rpubs.com/hrbrmstr/extractmsg . My R session is aborted each time I'm trying "msg$body". But most of the other emails are not problematic.

I think it may be another encoding issue in reticulate as I saw here : rstudio/reticulate#90 (comment) . Because all the emails which fail have some special characters inside (from russia...).

If you find any solution, i would be interested !

Thanks,

Kim

Change default for file names in save_attachment()

Hello. Thanks for this great package. Helped me a lot. What about changing the default for the file name in the save_attachment() function? I got confused for some time, because I "only" received the short name. Only by looking at the msg structure and the availabilty of "long_filename", I saw the solution. Why don't put this as an option into save_attachment() ? Thanks!

Installation failed

After running this command: devtools::install_github("hrbrmstr/msgxtractr")
I become this failure msg:
Installation failed: Could not find build tools necessary to build msgxtractr

Rtools are installed and setted at path:
C:\RBuildTools\3.4\bin\make.exe
c:\Rtools\bin\make.exe

SessionInfo:

R version 3.4.1 (2017-06-30)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows >= 8 x64 (build 9200)

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

loaded via a namespace (and not attached):
[1] httr_1.3.1 compiler_3.4.1 R6_2.2.2 tools_3.4.1 withr_2.0.0 curl_2.8.1 yaml_2.1.14 memoise_1.1.0
[9] git2r_0.19.0 digest_0.6.12 devtools_1.13.3

What can the problem be? I have tried it with remotes::github:install and githubinstall("msgxtractr") but none of them worked

Thank you for your help!

Problem with read_msg in a loop

Hi again,

Now i'm trying to read my 10000 .msg I wanted to use for a text mining exercise.

But when i'm doing a loop or a lapply to read them, it does not seem to be able to treat them if I use more than around 500 emails :

for example :

liste <- NULL
for(i in dir("C:/Users/Desktop/TOTO")){
msg <- read_msg(paste0("C:/Users/Desktop/TOTO",i))
liste[[i]] <- c(msg$header$Date, msg$sender$sender_name, msg$display_envelope$display_to,msg$subject,msg$body)
}

all liste[[i]]$text are filled from 1 to 509 but then from 510 to 10 000 it's NULL

liste[[508]][1]
[[1]]
[1] "Thu, 27 Jul 2017 11:22:18 +0000"

liste[[509]][1]
[[1]]
[1] "Fri, 10 Mar 2017 16:23:47 +0100"

liste[[510]][1]
$text
NULL

liste[[511]][1]
$text
NULL

... etc.

And I obtain the same error when i'm doing 3 loops of 250 elements for the 3rd one.

Then, when I quit Rstudio it never wants me to save the project, showing the following error (which may be linked with what i said above) :

Error in gzfile(file, "wb") : cannot open the connection
In addition: Warning message:
In gzfile(file, "wb") :
cannot open compressed file 'C:/Users/Desktop/test_mails/.RDataTmp', probable reason 'Too many open files'
Error: Error in gzfile(file, "wb") : cannot open the connection
In addition: Warning message:
In file.remove(outfile) :
cannot remove file 'C:/Users/Desktop/test_mails/.RDataTmp', reason 'No such file or directory'

Any idea of the source of the problem ? Any solution for me ?

Thank you !

Couldn't install

I wasn't able to install this on a Win 7 x64 machine. There were lots of warnings and errors, but I'm not sure what to make of them. See below:

In R CMD INSTALL
"C:/PROGRA1/R/R-341.3/bin/x64/R" --no-site-file --no-environ --no-save --no-restore
--quiet CMD INSTALL
"C:/Users/cstubbs/AppData/Local/Temp/Rtmpuaxv8o/devtools3048369d2c1a/hrbrmstr-msgxtractr-6769a39"
--library="C:/Users/cstubbs/Documents/R/win-library/3.4" --install-tests

  • installing source package 'msgxtractr' ...
    ** libs

*** arch - i386
c:/Rtools/mingw_32/bin/g++ -std=gnu++11 -I"C:/PROGRA1/R/R-341.3/include" -DNDEBUG -I"C:/Users/cstubbs/Documents/R/win-library/3.4/Rcpp/include" -O2 -Wall -mtune=generic -c RcppExports.cpp -o RcppExports.o
c:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA1/R/R-341.3/include" -DNDEBUG -I"C:/Users/cstubbs/Documents/R/win-library/3.4/Rcpp/include" -O3 -Wall -std=gnu99 -mtune=generic -c alloc.c -o alloc.o
c:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA1/R/R-341.3/include" -DNDEBUG -I"C:/Users/cstubbs/Documents/R/win-library/3.4/Rcpp/include" -O3 -Wall -std=gnu99 -mtune=generic -c attr.c -o attr.o
attr.c: In function 'attr_dump':
attr.c:163:2: warning: implicit declaration of function 'strncpy' [-Wimplicit-function-declaration]
strncpy (buf, (char*)attr->buf, attr->len);
^
attr.c:163:2: warning: incompatible implicit declaration of built-in function 'strncpy'
c:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA1/R/R-341.3/include" -DNDEBUG -I"C:/Users/cstubbs/Documents/R/win-library/3.4/Rcpp/include" -O3 -Wall -std=gnu99 -mtune=generic -c date.c -o date.o
c:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA1/R/R-341.3/include" -DNDEBUG -I"C:/Users/cstubbs/Documents/R/win-library/3.4/Rcpp/include" -O3 -Wall -std=gnu99 -mtune=generic -c debug.c -o debug.o
c:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA1/R/R-341.3/include" -DNDEBUG -I"C:/Users/cstubbs/Documents/R/win-library/3.4/Rcpp/include" -O3 -Wall -std=gnu99 -mtune=generic -c file.c -o file.o
file.c: In function 'file_write':
file.c:73:2: warning: implicit declaration of function 'strdup' [-Wimplicit-function-declaration]
file->name = strdup( TNEF_DEFAULT_FILENAME );
^
file.c:73:15: warning: incompatible implicit declaration of built-in function 'strdup'
file->name = strdup( TNEF_DEFAULT_FILENAME );
^
file.c:83:19: warning: incompatible implicit declaration of built-in function 'strdup'
file->path = strdup( TNEF_DEFAULT_FILENAME );
^
file.c:92:9: warning: incompatible implicit declaration of built-in function 'strdup'
path = strdup( TNEF_DEFAULT_FILENAME );
^
file.c: In function 'file_add_mapi_attrs':
file.c:180:16: warning: incompatible implicit declaration of built-in function 'strdup'
file->name = strdup( (char*)a->values[0].data.buf );
^
file.c: In function 'file_add_attr':
file.c:235:15: warning: incompatible implicit declaration of built-in function 'strdup'
file->name = strdup( (char*)attr->buf );
^
c:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA1/R/R-341.3/include" -DNDEBUG -I"C:/Users/cstubbs/Documents/R/win-library/3.4/Rcpp/include" -O3 -Wall -std=gnu99 -mtune=generic -c mapi_attr.c -o mapi_attr.o
c:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA1/R/R-341.3/include" -DNDEBUG -I"C:/Users/cstubbs/Documents/R/win-library/3.4/Rcpp/include" -O3 -Wall -std=gnu99 -mtune=generic -c mapi_names.c -o mapi_names.o
c:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA1/R/R-341.3/include" -DNDEBUG -I"C:/Users/cstubbs/Documents/R/win-library/3.4/Rcpp/include" -O3 -Wall -std=gnu99 -mtune=generic -c mapi_types.c -o mapi_types.o
c:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA1/R/R-341.3/include" -DNDEBUG -I"C:/Users/cstubbs/Documents/R/win-library/3.4/Rcpp/include" -O3 -Wall -std=gnu99 -mtune=generic -c options.c -o options.o
c:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA1/R/R-341.3/include" -DNDEBUG -I"C:/Users/cstubbs/Documents/R/win-library/3.4/Rcpp/include" -O3 -Wall -std=gnu99 -mtune=generic -c path.c -o path.o
path.c: In function 'could_be_a_windows_path':
path.c:148:5: warning: implicit declaration of function 'rindex' [-Wimplicit-function-declaration]
up = rindex( fname, '\' );
^
path.c:148:10: warning: incompatible implicit declaration of built-in function 'rindex'
up = rindex( fname, '\' );
^
path.c:164:2: warning: implicit declaration of function 'index' [-Wimplicit-function-declaration]
if ( index( fname, (int)up ) )
^
path.c:164:7: warning: incompatible implicit declaration of built-in function 'index'
if ( index( fname, (int)up ) )
^
path.c: In function 'munge_fname':
path.c:328:13: warning: incompatible implicit declaration of built-in function 'rindex'
base = rindex( dir, (int)'\' );
^
c:/Rtools/mingw_32/bin/g++ -std=gnu++11 -I"C:/PROGRA1/R/R-341.3/include" -DNDEBUG -I"C:/Users/cstubbs/Documents/R/win-library/3.4/Rcpp/include" -O2 -Wall -mtune=generic -c pole.cpp -o pole.o
pole.cpp: In member function 'void POLE::DirTree::load(unsigned char
, unsigned int)':
pole.cpp:670:14: warning: variable 'prefix' set but not used [-Wunused-but-set-variable]
unsigned prefix = 32;
^
c:/Rtools/mingw_32/bin/g++ -std=gnu++11 -I"C:/PROGRA1/R/R-341.3/include" -DNDEBUG -I"C:/Users/cstubbs/Documents/R/win-library/3.4/Rcpp/include" -O2 -Wall -mtune=generic -c r_pole.cpp -o r_pole.o
In file included from r_pole.cpp:15:0:
util.h:36:8: error: 'uint32' does not name a type
extern uint32 GETINT32(unsigned char
p);
^
util.h:37:8: error: 'uint16' does not name a type
extern uint16 GETINT16(unsigned charp);
^
util.h:38:8: error: 'uint8' does not name a type
extern uint8 GETINT8(unsigned char
p);
^
util.h:41:8: error: 'uint32' does not name a type
extern uint32 geti32(FILE *fp);
^
util.h:42:8: error: 'uint16' does not name a type
extern uint16 geti16(FILE *fp);
^
util.h:43:8: error: 'uint8' does not name a type
extern uint8 geti8(FILE fp);
^
In file included from mapi_attr.h:35:0,
from rtf.h:32,
from r_pole.cpp:17:
mapi_types.h:30:19: warning: 'get_mapi_type_str' initialized and declared 'extern'
get_mapi_type_str(uint16 d);
^
mapi_types.h:30:19: error: 'uint16' was not declared in this scope
In file included from mapi_attr.h:36:0,
from rtf.h:32,
from r_pole.cpp:17:
mapi_names.h:440:19: warning: 'get_mapi_name_str' initialized and declared 'extern'
get_mapi_name_str(uint16 d);
^
mapi_names.h:440:19: error: 'uint16' was not declared in this scope
In file included from rtf.h:32:0,
from r_pole.cpp:17:
mapi_attr.h:43:5: error: 'uint32' does not name a type
uint32 data1;
^
mapi_attr.h:44:5: error: 'uint16' does not name a type
uint16 data2;
^
mapi_attr.h:45:5: error: 'uint16' does not name a type
uint16 data3;
^
mapi_attr.h:46:5: error: 'uint8' does not name a type
uint8 data4[8];
^
mapi_attr.h:55:2: error: 'uint16' does not name a type
uint16 bytes2;
^
mapi_attr.h:56:2: error: 'uint32' does not name a type
uint32 bytes4;
^
mapi_attr.h:57:2: error: 'uint32' does not name a type
uint32 bytes8[2];
^
r_pole.cpp: In function 'Rcpp::RawVector decompress_rtf_data(unsigned char
, size_t, size_t)':
r_pole.cpp:92:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if ( cin+1 > lenc ) {
^
r_pole.cpp:107:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if ( cin+2 > lenc ){
^
r_pole.cpp:125:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if ( cout+rlen > lenu ) {
^
r_pole.cpp:142:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if ( cin+1 > lenc ) {
^
r_pole.cpp:147:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if ( cout+1 > lenu ) {
^
r_pole.cpp: In function 'Rcpp::RawVector decode_rtf(Rcpp::RawVector)':
r_pole.cpp:175:29: warning: unused variable 'rtf_uncompressed_magic' [-Wunused-variable]
static const unsigned int rtf_uncompressed_magic = 0x414c454d;
^
make: *** [r_pole.o] Error 1
Warning: running command 'make -f "Makevars" -f "C:/PROGRA1/R/R-341.3/etc/i386/Makeconf" -f "C:/PROGRA1/R/R-341.3/share/make/winshlib.mk" CXX='$(CXX11) $(CXX11STD)' CXXFLAGS='$(CXX11FLAGS)' CXXPICFLAGS='$(CXX11PICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX11LDFLAGS)' SHLIB_LD='$(SHLIB_CXX11LD)' SHLIB="msgxtractr.dll" OBJECTS="RcppExports.o alloc.o attr.o date.o debug.o file.o mapi_attr.o mapi_names.o mapi_types.o options.o path.o pole.o r_pole.o rtf.o tnef.o tnef_names.o tnef_types.o util.o write.o xstrdup.o"' had status 2
ERROR: compilation failed for package 'msgxtractr'

  • removing 'C:/Users/cstubbs/Documents/R/win-library/3.4/msgxtractr'
    In R CMD INSTALL
    Installation failed: Command failed (1)

Unable to install via dev tools

Hi
In R console i try to install this package, however it does not appear to work. Currently using 3.5.2 - do i need to downgrade my R?

>devtools::install_github("hrbrmstr/msgxtract
Downloading GitHub repo hrbrmstr/msgxtractr@master
Error in process_initialize(self, private, command, args, stdin, stdout,  : 
  Command not found
In addition: Warning messages:
1: In untar2(tarfile, files, list, exdir) :
  skipping pax global extended headers
2: In untar2(tarfile, files, list, exdir) :
  skipping pax global extended headers

HTML body not extracted

Bug description: when importing .msg files, the html body is not extracted.

Minimal replicable example

The attached email have an html body with encoding CP-1252 (west Europe)
ex_no_html_body.zip

In R, I did the following:

msg <- msgxtractr::read_msg("ex_no_html_body.msg")
str(msg)
List of 8
 $ headers         : NULL
 $ sender          : list()
 $ recipients      :List of 1
  ..$ :List of 3
  .. ..$ display_name : NULL
  .. ..$ address_type : NULL
  .. ..$ email_address: NULL
 $ subject         : NULL
 $ body            :List of 2
  ..$ text: chr " \r\nTest table\r\n \r\n1\r\n2\r\n3\r\n4\r\n5\r\n6\r\n7\r\n8\r\n9\r\n \r\n"
  ..$ html: NULL
 $ attachments     : list()
 $ display_envelope:List of 1
  ..$ display_to: chr "[email protected]"
 $ times           :List of 3
  ..$ creation_time: NULL
  ..$ last_mod_time: NULL
 - attr(*, "class")= chr "msg"

The HTML element is empty. I checked if my message what not in RTF.

Any idea ?

By the way: thank you for this package !

save_attachments with nested msg messages dose not work

Hi,
I have a msg file that has 2 attachments an Excel file and a msg file.
The attached msg file has also 2 attachments 1 picture and 1 excel file.
So the structure is like this:
Msg
-.msg
-- .png
-- .xlsx
-.xlsx

If I try to save the attachments with msgxtractr::save_attachments(msg_file, use_short = F)
I get follwing error:

> msgxtractr::save_attachments(msg_file, use_short = F)
Saving D:/Entwurf/R/msgexample/R_logo.png (22,097 bytes)Saving D:/Entwurf/R/msgexample/Excel_file_1.xlsx (22,097 bytes)
Error in file(con, "wb") : invalid 'description' argument

To me, it seems that the read function reads all nested msg files and "saves" all attachments from this second msg file in one list element. But the save function cannot deal with several attachments in one element...

msg_file_list

> sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252    LC_MONETARY=German_Germany.1252
[4] LC_NUMERIC=C                    LC_TIME=German_Germany.1252    

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

other attached packages:
[1] msgxtractr_0.2.1

loaded via a namespace (and not attached):
[1] colorspace_1.4-0 scales_1.0.0     compiler_3.4.4   tools_3.4.4      yaml_2.2.0       Rcpp_1.0.0       munsell_0.5.0

functions not exported?

Having some trouble getting this to install in Windows. Logs below:

Downloading GitHub repo hrbrmstr/msgxtractr@master
from URL https://api.github.com/repos/hrbrmstr/msgxtractr/zipball/master
Installing msgxtractr
"C:/PROGRA~1/R/R-35~1.1/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL  \
  "C:/Users/ajae/AppData/Local/Temp/1/Rtmp0UELL2/devtools333839915b3c/hrbrmstr-msgxtractr-0e4db75" --library="D:/R/win-library/3.5" --install-tests 

* installing *source* package 'msgxtractr' ...
** libs

*** arch - i386
c:/Rtools/mingw_32/bin/g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-35~1.1/include" -DNDEBUG  -I"D:/R/win-library/3.5/Rcpp/include"        -O2 -Wall  -mtune=generic -c RcppExports.cpp -o RcppExports.o
c:/Rtools/mingw_32/bin/g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-35~1.1/include" -DNDEBUG  -I"D:/R/win-library/3.5/Rcpp/include"        -O2 -Wall  -mtune=generic -c pole.cpp -o pole.o
pole.cpp: In member function 'void POLE::DirTree::load(unsigned char*, unsigned int)':
pole.cpp:670:14: warning: variable 'prefix' set but not used [-Wunused-but-set-variable]
     unsigned prefix = 32;
              ^
c:/Rtools/mingw_32/bin/g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-35~1.1/include" -DNDEBUG  -I"D:/R/win-library/3.5/Rcpp/include"        -O2 -Wall  -mtune=generic -c r_pole.cpp -o r_pole.o
r_pole.cpp: In function 'bool is_rtf(Rcpp::RawVector)':
r_pole.cpp:38:10: warning: variable 'compr_size' set but not used [-Wunused-but-set-variable]
   size_t compr_size = 0L;
          ^
r_pole.cpp:39:10: warning: variable 'uncompr_size' set but not used [-Wunused-but-set-variable]
   size_t uncompr_size = 0L;
          ^
r_pole.cpp: In function 'Rcpp::RawVector decode_rtf(Rcpp::RawVector)':
r_pole.cpp:179:29: warning: unused variable 'rtf_uncompressed_magic' [-Wunused-variable]
   static const unsigned int rtf_uncompressed_magic = 0x414c454d;
                             ^
c:/Rtools/mingw_32/bin/g++ -shared -s -static-libgcc -o msgxtractr.dll tmp.def RcppExports.o pole.o r_pole.o -L. -LC:/PROGRA~1/R/R-35~1.1/bin/i386 -lR
installing to D:/R/win-library/3.5/msgxtractr/libs/i386

*** arch - x64
c:/Rtools/mingw_64/bin/g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-35~1.1/include" -DNDEBUG  -I"D:/R/win-library/3.5/Rcpp/include"        -O2 -Wall  -mtune=generic -c RcppExports.cpp -o RcppExports.o
c:/Rtools/mingw_64/bin/g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-35~1.1/include" -DNDEBUG  -I"D:/R/win-library/3.5/Rcpp/include"        -O2 -Wall  -mtune=generic -c pole.cpp -o pole.o
pole.cpp: In member function 'void POLE::DirTree::load(unsigned char*, unsigned int)':
pole.cpp:670:14: warning: variable 'prefix' set but not used [-Wunused-but-set-variable]
     unsigned prefix = 32;
              ^
c:/Rtools/mingw_64/bin/g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-35~1.1/include" -DNDEBUG  -I"D:/R/win-library/3.5/Rcpp/include"        -O2 -Wall  -mtune=generic -c r_pole.cpp -o r_pole.o
r_pole.cpp: In function 'bool is_rtf(Rcpp::RawVector)':
r_pole.cpp:38:10: warning: variable 'compr_size' set but not used [-Wunused-but-set-variable]
   size_t compr_size = 0L;
          ^
r_pole.cpp:39:10: warning: variable 'uncompr_size' set but not used [-Wunused-but-set-variable]
   size_t uncompr_size = 0L;
          ^
r_pole.cpp: In function 'Rcpp::RawVector decode_rtf(Rcpp::RawVector)':
r_pole.cpp:179:29: warning: unused variable 'rtf_uncompressed_magic' [-Wunused-variable]
   static const unsigned int rtf_uncompressed_magic = 0x414c454d;
                             ^
c:/Rtools/mingw_64/bin/g++ -shared -s -static-libgcc -o msgxtractr.dll tmp.def RcppExports.o pole.o r_pole.o -L. -LC:/PROGRA~1/R/R-35~1.1/bin/x64 -lR
installing to D:/R/win-library/3.5/msgxtractr/libs/x64
** inst
** tests
** help
*** installing help indices
  converting help for package 'msgxtractr'
    finding HTML links ... done
    is_rtf                                  html  
    msgxtractr                              html  
    print.msg                               html  
    read_msg                                html  
    save_attachments                        html  
** building package indices
** testing if installed package can be loaded
*** arch - i386
Warning: S3 method 'print.msg' was declared in NAMESPACE but not found
Error: package or namespace load failed for 'msgxtractr' in namespaceExport(ns, exports):
 undefined exports: is_rtf, read_msg, save_attachments
Error: loading failed
Execution halted
*** arch - x64
Warning: S3 method 'print.msg' was declared in NAMESPACE but not found
Error: package or namespace load failed for 'msgxtractr' in namespaceExport(ns, exports):
 undefined exports: is_rtf, read_msg, save_attachments
Error: loading failed
Execution halted
ERROR: loading failed for 'i386', 'x64'
* removing 'D:/R/win-library/3.5/msgxtractr'
In R CMD INSTALL
Installation failed: Command failed (1)
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

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

loaded via a namespace (and not attached):
 [1] httr_1.3.1      compiler_3.5.1  R6_2.2.2        tools_3.5.1     withr_2.1.2     curl_3.2        memoise_1.1.0   git2r_0.23.0    digest_0.6.17  
[10] packrat_0.4.9-3 devtools_1.13.6

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.