chrisbra / wikipedia2text

A commandline tool for querying the Wikipedia
Other
32 stars 4 forks source link

Error '<space> not found'. #4

Closed FernandoBasso closed 6 years ago

FernandoBasso commented 6 years ago

Downloaded the script and added it to somewhere in my PATH and made it executable. Running it with simply wikipedia2text -r would produce:

which: no  in (<my path here>)
 not found

Note space in "no in" and "not found".

I don't have an RC file, like the script tries to check:

# First read in the Run configuration File, if one is found
if [ -r ~/.`basename $0`rc ]; then
    source ~/.`basename $0`rc
    ABROWSER=${BROWSER}
fi

But I do have BROWSER env var set.

Still, the script was failing for me with the error mentioned above. It so happens that the program exits from these lines:

# Check for Alternative Browser
if [ -n "${ABROWSER}" -o "${BROWSER}" ]; then
    BROWSER=$(which "${ABROWSER}") ||  errorExit "${ABROWSER} not found"
else
   { BROWSER=$(which w3m) || ... ; } || errorExit "No Browser found"
fi

But why is the program exiting if I have BROWSER? Shouldn't it exit if I don't have ABROWSER set but it is not available on the system?

I changed that condition to simply:

if [ -n "${ABROWSER}" ]; then
    BROWSER=$(which "${ABROWSER}") ||  errorExit "${ABROWSER} not found"
else
   { BROWSER=$(which w3m) || ...) ; } || errorExit "No Browser found"
fi

Which means, if I have ABROWSER set, either find it, or exit. Else, try one of the other options.

Am I misunderstanding what the conditions are supposed to check?

Thanks a lot for this very useful script.

chrisbra commented 6 years ago

It is actually strange, that nobody noticed until now :) But thanks. Let's test separately for $BROWSER.

stroobandt commented 5 years ago

Any chance of pushing a remedied version to Ubuntu LTS 18.04? This bug is currently crippling wikipedia2text quite a bit on Ubuntu.

chrisbra commented 5 years ago

I have nothing to do with packaging it on Ubuntu. Perhaps tagging would help? ping @xtaran who I believe maintains this package.

xtaran commented 5 years ago

I only maintain the Debian package. Ubuntu pulls it from Debian (as it does with most other packages, too) and if they don't change anything, my name also appears in the Maintainer field of the untouched package. I though have no influence on what is fixed in a Ubuntu stable or LTS release.

You basically need to open an Ubuntu bug report (requires a Launchpad account) and stating that this is an issue which is already fixed in later Ubuntu releases (probably since 18.10 Cosmic) but needs to be backported to 18.04 Bionic. Tagging it explicitly as "bionic" might help, too.