[
https://issues.apache.org/jira/browse/AMBARI-24763?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16646953#comment-16646953
]
ASF GitHub Bot commented on AMBARI-24763:
-----------------------------------------
adoroszlai commented on a change in pull request #5: AMBARI-24763. Infra Solr
upgrade (2.7.x): ValueError: invalid literal for float():
URL: https://github.com/apache/ambari-infra/pull/5#discussion_r224575118
##########
File path: ambari-infra-solr-client/src/main/python/migrationHelper.py
##########
@@ -946,9 +946,10 @@ def human_size(size_bytes):
return "%s %s" % (formatted_size, suffix)
def parse_size(human_size):
+ import locale
units = {"bytes": 1, "KB": 1024, "MB": 1024**2, "GB": 1024**3, "TB": 1024**4
}
number, unit = [string.strip() for string in human_size.split()]
- return int(float(number)*units[unit])
+ return int(locale.atof(number)*units[unit])
Review comment:
I'm not sure `locale.atof` fixes the problem.
```
>>> locale.atof("1,013.88")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.7/locale.py", line 316, in atof
return func(string)
ValueError: invalid literal for float(): 1,013.88
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Infra Solr upgrade (2.7.x): ValueError: invalid literal for float():
> --------------------------------------------------------------------
>
> Key: AMBARI-24763
> URL: https://issues.apache.org/jira/browse/AMBARI-24763
> Project: Ambari
> Issue Type: Bug
> Affects Versions: 2.7.0
> Reporter: Olivér Szabó
> Assignee: Olivér Szabó
> Priority: Blocker
> Labels: pull-request-available
> Fix For: 2.7.3
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> exception:
> {code:java}
> File "/usr/lib/ambari-infra-solr-client/migrationHelper.py", line 951, in
> parse_size
> return int(float(number)*units[unit])
> ValueError: invalid literal for float(): 1,013.88
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)