trinker / textreadr

Tools to uniformly read in text data including semi-structured transcripts
74 stars 5 forks source link

check_antiword_installed doesn't find antiword #5

Closed jjesusfilho closed 7 years ago

jjesusfilho commented 7 years ago

I manually downloaded antiword, but the command check_antiword_installed doesn't find it. I am using linux. If I type in command line "which antiword" I get the following response: usr/bin/antiword. But textreadr can't find it.

trinker commented 7 years ago

What does this give you:

check_antiword_installed('usr/bin/antiword/antiword.exe')
jjesusfilho commented 7 years ago

check_antiword_installed('usr/bin/antiword/antiword.exe') checking if antiword is installed... antiword does not appear to be installed in root. Would you like me to try to install it there? 1: Yes 2: No Selection: 1Let me try... Hold on. It may take some time... Error in check_antiword_installed("usr/bin/antiword/antiword.exe") : Currently only Windows installs are handled. Please consider installing yourself... http://www.winfield.demon.nl

José de Jesus Filho, PhD Analista de dados jurídicos (11) 2372-9811 (11) 98522-0210 http://www.josejesus.info

2017-04-17 16:11 GMT-03:00 Tyler Rinker notifications@github.com:

What does this give you:

check_antiword_installed('usr/bin/antiword/antiword.exe')

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/trinker/textreadr/issues/5#issuecomment-294563098, or mute the thread https://github.com/notifications/unsubscribe-auth/ALLi8duzKbswNHyTbjhmJY2txySfEYfaks5rw7logaJpZM4M_VpE .

trinker commented 7 years ago

There are some Windows based checks that need to be extended. I will utilize Unix approaches conditionally. Can you try the following:

Sys.which("antiword")
jjesusfilho commented 7 years ago

Sys.which("antiword") antiword "/usr/bin/antiword"

José de Jesus Filho, PhD Analista de dados jurídicos (11) 2372-9811 (11) 98522-0210 http://www.josejesus.info

2017-04-17 23:31 GMT-03:00 Tyler Rinker notifications@github.com:

There are some Windows based checks. I will utilize Unix approaches conditionally. Can you try the following:

Sys.which("antiword")

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/trinker/textreadr/issues/5#issuecomment-294656096, or mute the thread https://github.com/notifications/unsubscribe-auth/ALLi8ULf5HLza3cKCEodJ6LPF-hgEE7Wks5rxCCYgaJpZM4M_VpE .

trinker commented 7 years ago

Thank you for that. Can you tell me what this gives:

antiword_loc <- function(){

    myPaths <- c("antiword", "~/.cabal/bin/antiword", "~/Library/Haskell/bin/antiword",
        "C:\\PROGRA~1\\antiword\\antiword.exe", "/usr/bin/antiword",
        "/Applications/antiword.app/Contents/MacOS/antiword", 
        file.path(strsplit(getwd(), "(/|\\\\)+")[[1]][1], 'antiword/antiword.exe'))

    panloc <- Sys.which(myPaths)
    temp <- panloc[panloc != ""]

    short.path <- which.min(unlist(lapply(gregexpr("[Aa]ntiword", temp), "[[", 1)))
    temp[short.path]
}

antiword_loc()

file.exists(antiword_loc())

And...to install antiword did you use sudo apt-get install antiword or did you download the tar ball, extract the contents, navigate to antiword directory and run:

make
sudo make install
jjesusfilho commented 7 years ago

Yes:

antiword_loc() antiword "/usr/bin/antiword"

José de Jesus Filho, PhD Analista de dados jurídicos (11) 2372-9811 (11) 98522-0210 http://www.josejesus.info

2017-04-18 10:04 GMT-03:00 Tyler Rinker notifications@github.com:

Thank you for that. Can you tell me if this gives the proper location:

antiword_loc <- function(){

myPaths <- c("antiword", "~/.cabal/bin/antiword", "~/Library/Haskell/bin/antiword",
    "C:\\PROGRA~1\\antiword\\antiword.exe", "/usr/bin/antiword",
    "/Applications/antiword.app/Contents/MacOS/antiword",
    file.path(strsplit(getwd(), "(/|\\\\)+")[[1]][1], 'antiword/antiword.exe'))

panloc <- Sys.which(myPaths)
temp <- panloc[panloc != ""]

short.path <- which.min(unlist(lapply(gregexpr("[Aa]ntiword", temp), "[[", 1)))
temp[short.path]

}

antiword_loc()

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/trinker/textreadr/issues/5#issuecomment-294834229, or mute the thread https://github.com/notifications/unsubscribe-auth/ALLi8e8E8IImWnuFj5SmBFx8qVCIhRP8ks5rxLTNgaJpZM4M_VpE .

trinker commented 7 years ago

Thank you I edited the response on GitHub. Can you take a look and answer the othe rpotion: https://github.com/trinker/textreadr/issues/5#issuecomment-294834229

Thank you for your help.

On Tue, Apr 18, 2017 at 10:24 AM, José de Jesus Filho < notifications@github.com> wrote:

Yes:

antiword_loc() antiword "/usr/bin/antiword"

José de Jesus Filho, PhD Analista de dados jurídicos (11) 2372-9811 (11) 98522-0210 http://www.josejesus.info

2017-04-18 10:04 GMT-03:00 Tyler Rinker notifications@github.com:

Thank you for that. Can you tell me if this gives the proper location:

antiword_loc <- function(){

myPaths <- c("antiword", "~/.cabal/bin/antiword", "~/Library/Haskell/bin/ antiword", "C:\PROGRA~1\antiword\antiword.exe", "/usr/bin/antiword", "/Applications/antiword.app/Contents/MacOS/antiword", file.path(strsplit(getwd(), "(/|\\)+")[[1]][1], 'antiword/antiword.exe'))

panloc <- Sys.which(myPaths) temp <- panloc[panloc != ""]

short.path <- which.min(unlist(lapply(gregexpr("[Aa]ntiword", temp), "[[", 1))) temp[short.path] }

antiword_loc()

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/trinker/textreadr/issues/5#issuecomment-294834229, or mute the thread https://github.com/notifications/unsubscribe-auth/ ALLi8e8E8IImWnuFj5SmBFx8qVCIhRP8ks5rxLTNgaJpZM4M_VpE .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/trinker/textreadr/issues/5#issuecomment-294861218, or mute the thread https://github.com/notifications/unsubscribe-auth/ABrnzg9X-3cJbdKsA20F8hECETCLBNleks5rxMe2gaJpZM4M_VpE .

jjesusfilho commented 7 years ago

I installed it using sudo apt-get install antiword

trinker commented 7 years ago

One more part can you run:

file.exists(antiword_loc())
jjesusfilho commented 7 years ago

file.exists(antiword_loc()) [1] TRUE

trinker commented 7 years ago

@jjesusfilho can you try reinstalling the dev version

library(devtools)
install_github('trinker/textreadr')
library(textreadr)

...and try the following:

check_antiword_installed()
check_antiword_installed('usr/bin/antiword')

x <- system.file("docs/Yasmine_Interview_Transcript.doc", package = "textreadr")
read_doc(x)

Hopefully, we can close this if all checks out.

jjesusfilho commented 7 years ago

When I run: check_antiword_installed()

I get: checking if antiword is installed...

antiword appears to be installed.

...Let the .doc extraction begin!

But when I run:

check_antiword_installed('usr/bin/antiword') I get:

checking if antiword is installed...

Error in install_anitword_linux() : Antiword must be installed first. Please install first:

sudo apt-get install antiword

Anyway, It's working now and I was able to read all my doc texts.

Thank you very much. By the way, I love your packages and I have promoted them in the Brazilian R community.

Cheers.

trinker commented 7 years ago

Thank you very much. Your support and word of mouth advertisement are greatly appreciated.

Can you try one last thing. I think I know the original problem with the path. Try:

check_antiword_installed('/usr/bin/antiword')

I believe it needs a leading slash on Linux. I have added your contribution to the NEWS file as well: https://github.com/trinker/textreadr/blob/master/NEWS

trinker commented 7 years ago

I got Linux up and running and confirm it was the leading slash. I'm closing this.