Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble running the Compare tool due to locale settings #2

Closed
svenruetz opened this issue Jan 21, 2015 · 6 comments
Closed

Trouble running the Compare tool due to locale settings #2

svenruetz opened this issue Jan 21, 2015 · 6 comments
Assignees
Labels

Comments

@svenruetz
Copy link
Collaborator

from: https://trac.modelica.org/Modelica/ticket/1646

I tried running the Compare tool (r8061) with a simple csv file using the command

Compare.exe Example.csv Example.csv

This however gives an error

2015-01-20Z09:45:36 [       Error ] Exception during run: Input string was not in a correct format.

where the problematic part seems to be the tolerance as the below command works fine,

Compare.exe -t 0,001 Example.csv Example.csv

This needs to be fixed so that it works out of the box. Additionally this dependency on the locale makes it difficult to use the Compare tool in other tools.

@svenruetz svenruetz added the bug label Jan 21, 2015
@svenruetz svenruetz added this to the regression-test milestone Jan 21, 2015
@svenruetz svenruetz self-assigned this Jan 21, 2015
@svenruetz
Copy link
Collaborator Author

Problem might be, that the Option tolerance is preset using a string:

[Option('t', "tolerance", DefaultValue = "0.002", Required = false, HelpText = "Set the width of the tube at discontinuity in x-direction [Default is 0.002].")]
public string Tolerance { get; set; }

Removing the default value should fix the issue.

@ghost
Copy link

ghost commented Jan 23, 2015

Unfortunately that solution is still locale dependent, which in our case causes problems since we use CSV Compare from within our software, i.e. the calls are done from scripts.
IMHO it's bad design to have a program command line dependent on the users locale settings.
This might be a separate issue though.

@svenruetz
Copy link
Collaborator Author

Can you tell me which locale fails and which settings? The code already implemented in csv compare for parsing the value for the tolerance handles "0.002", "0,002" and "2e-3" and should not depent on locale settings; I'm going to check this. The program should of course not be locale dependent; the problem here (I think) was the hard coded string for the default value. Without this hard coded value, the program should correctly parse the tolerance in any of the 3 formattings.

@ghost
Copy link

ghost commented Jan 23, 2015

Ok that is good to hear, then we are on the same page. However the current behaviour that we see with Christian Andersson's (from MA ticket linked above) build of r8061 is strange, it really looks like if it is locale dependent.
The computers that I have problems with have Windows 7 with Swedish number/date formatting, i.e. if you go Control Panel -> Region and Language -> Additional settings... There the decimal symbol is a comma (,). If we try to run CSV Compare without -t set we get an error. Presumably since the default value is 0.002 and given the language settings that is not a valid number. if -t is specified to i.e. 0,001 then the error goes away and the tolerance seems to be correct.
Also, it works as exepcted if I change the decimal symbol in the language settings to a dot.

So sorry to say it but it really seems as if computer locale affects the program.

svenruetz pushed a commit that referenced this issue Jan 23, 2015
…sed exception on systems with "," instead of "." as double separator
@svenruetz
Copy link
Collaborator Author

I found the issue. It was a bug in the code. I used the commandline option directly and not the parsed object. The default value can stay as it is. I debugged it using swedish locale settings on my computer.

@ghost
Copy link

ghost commented Jan 23, 2015

Nice :)
Thank you for the help.

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

No branches or pull requests

1 participant