Bugs item #1276437, was opened at 2005-08-30 18:16 Message generated for change (Comment added) made by quiver You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1276437&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: oswaldo (oswaldohm) Assigned to: Facundo Batista (facundobatista) Summary: error converting locale number to decimal Initial Comment: Hello, When I try con convert a locale formated number to decimal y generate an error: >>> import locale >>> import decimal >>> locale.setlocale(locale.LC_ALL, "sp") 'Spanish_Spain.1252' >>> n = locale.format("%f", 123456.78, 1) >>> n '123.456,780000' >>> d = decimal.Decimal(n) File "<console>", line 1, in ? File "C:\Python24\Lib\decimal.py", line 571, in __new__ self._sign, self._int, self._exp = context._raise_error(ConversionSyntax) File "C:\Python24\Lib\decimal.py", line 2266, in _raise_error raise error, explanation ''' decimal.InvalidOperation : ''' >>> Thanks ---------------------------------------------------------------------- Comment By: George Yoshida (quiver) Date: 2005-08-30 19:48 Message: Logged In: YES user_id=671362 I guess this is because '123.456,780000' does not conform to the decimal numeric string syntax : decimal-part ::= digits '.' [digits] | ['.'] digits see : http://docs.python.org/lib/node177.html It does not seem to be a bug to me. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1276437&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com