Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

ping in utils.py needs LANG=C #133

Open
jtranholm opened this issue Nov 9, 2019 · 3 comments
Open

ping in utils.py needs LANG=C #133

jtranholm opened this issue Nov 9, 2019 · 3 comments
Assignees

Comments

@jtranholm
Copy link

jtranholm commented Nov 9, 2019

I’m a Dane and is therefore using LANG=da_DK.UTF-8. In Danish the decimal separator is ',' (not '.'). And for the ping-command in get_rtt_loss (utils.py) I get the following error:
ping: bad timing interval: 0.2
This is naturally because ping uses the danish language where the decimal separator is “,”. The following works at my command line:
ping -c 3 -n -i 0,2 -W 1 some_domain_or_IP_address
But it does not work with -i 0.2.

To solve this problem you frequently define LANG=C as environment
before running an external command (ping in this case).

At the moment my nordnm is working because I am feeding it the LANG=C before running nordnm. But it would be better for everybody if you change the LANG environment in get_rtt_loss (utils.py) before running the ping command.

Best regards
Jacob Tranholm

@chadsr
Copy link
Owner

chadsr commented Dec 2, 2019

Thanks for pointing this out (and sorry for the slow reply). I never knew this was the case, so thanks for the TIL.

I will implement the environment variable into the command so it's in the next release!

@chadsr chadsr self-assigned this Dec 2, 2019
@chadsr
Copy link
Owner

chadsr commented Dec 2, 2019

Fix is here: b68c654

After some more thorough testing, I will send out a release containing it. Thanks for the feedback!

@szymonrychu
Copy link

It seems, that it's only a part of the answer- I was still receiving the errors even if I have something like (~117th line):

        ping_env["LANG"] = "C"

included in my local installation of the util.

Because of that I started digging and found this: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=825754 which actually helped- I've added:

        ping_env["LANG"] = "C"
        ping_env["LC_NUMERIC"] = "C"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants