Thread: [Pydev-users] [pydev - Users] Decimal conversion problem on Windows
Brought to you by:
fabioz
From: SourceForge.net <no...@so...> - 2006-09-06 15:38:34
|
Read and respond to this message at: https://sourceforge.net/forum/message.php?msg_id=3901785 By: akbowbender from decimal import * tangent1 = Decimal(raw_input("Enter tangent length from PT to PI: ")) Enter tangent length from PT to PI: 717.35 Traceback (most recent call last): File "C:\Documents and Settings\crhakari\workspace\Python\PythonTraining\CurveFit.py", line 6, in ? tangent1 = Decimal(raw_input("Enter tangent length from PT to PI: ")) 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 2267, in _raise_error raise error, explanation decimal.InvalidOperation This error only happens in Eclipse/PyDev on Windows. If run in Idle, the Windows command prompt or Eclipse/PyDev on Fedora, works fine. Could this be related to the raw_input problem noted in other posts? ______________________________________________________________________ You are receiving this email because you elected to monitor this forum. To stop monitoring this forum, login to SourceForge.net and visit: https://sourceforge.net/forum/unmonitor.php?forum_id=293649 |
From: SourceForge.net <no...@so...> - 2006-09-06 16:00:54
|
Read and respond to this message at: https://sourceforge.net/forum/message.php?msg_id=3901818 By: fabioz Surely appears related to the raw_input problem. If you do: Decimal(raw_input("Enter PI: ").replace('\r','')) It should work. Cheers, Fabio ______________________________________________________________________ You are receiving this email because you elected to monitor this forum. To stop monitoring this forum, login to SourceForge.net and visit: https://sourceforge.net/forum/unmonitor.php?forum_id=293649 |
From: SourceForge.net <no...@so...> - 2006-09-06 16:06:34
|
Read and respond to this message at: https://sourceforge.net/forum/message.php?msg_id=3901828 By: akbowbender Works now. Thanks! ______________________________________________________________________ You are receiving this email because you elected to monitor this forum. To stop monitoring this forum, login to SourceForge.net and visit: https://sourceforge.net/forum/unmonitor.php?forum_id=293649 |
From: SourceForge.net <no...@so...> - 2006-09-06 16:14:48
|
Read and respond to this message at: https://sourceforge.net/forum/message.php?msg_id=3901849 By: akbowbender Curious thing is, the following two lines work fine: delta = raw_input("Enter delta angle in DDD.MMSS format: ") radius = float(raw_input("Enter starting curve radius: ")) ______________________________________________________________________ You are receiving this email because you elected to monitor this forum. To stop monitoring this forum, login to SourceForge.net and visit: https://sourceforge.net/forum/unmonitor.php?forum_id=293649 |
From: SourceForge.net <no...@so...> - 2006-09-06 16:17:57
|
Read and respond to this message at: https://sourceforge.net/forum/message.php?msg_id=3901857 By: fabioz That's because 'float' is more forgiving about it. E.g.: float('10\r') will return 10.0 (and in the other case it would throw an error). Cheers, Fabio ______________________________________________________________________ You are receiving this email because you elected to monitor this forum. To stop monitoring this forum, login to SourceForge.net and visit: https://sourceforge.net/forum/unmonitor.php?forum_id=293649 |
From: SourceForge.net <no...@so...> - 2006-09-06 16:22:35
|
Read and respond to this message at: https://sourceforge.net/forum/message.php?msg_id=3901867 By: akbowbender What about the Windows connection? Is the problem a result of the way the Windows/Elipse console handles things. Like is said in my original post, works fine in Fedora. ______________________________________________________________________ You are receiving this email because you elected to monitor this forum. To stop monitoring this forum, login to SourceForge.net and visit: https://sourceforge.net/forum/unmonitor.php?forum_id=293649 |
From: SourceForge.net <no...@so...> - 2006-09-06 16:29:21
|
Read and respond to this message at: https://sourceforge.net/forum/message.php?msg_id=3901880 By: fabioz Actually I'd consider it more of a python bug, because it fails to remove the last '\r' if the console gives you a '\n\r' after entering the text in the console. Also, checking the docs for raw_input, they say that it only handles the '\n', so, it is left to you (the coder) handle the '\r'... I believe they were not expecting this to happen (I also don't think the '\n\r' is standard (but thinking better, what is standard in a console... just having a \n, or using the system default terminator as does Eclipse? -- which in windows is \n\r). I think that in linux the default is just the '\n' (so, this problem only happens in windows, where the default line terminator is '\n\r'). You can try submitting a bug to Eclipse and to python.org and see who'll fix it (that's not really in the scope of pydev). Cheers, Fabio ______________________________________________________________________ You are receiving this email because you elected to monitor this forum. To stop monitoring this forum, login to SourceForge.net and visit: https://sourceforge.net/forum/unmonitor.php?forum_id=293649 |