← Back to team overview

python-quantities-developers team mailing list archive

[Bug 313143] Re: inch unit causes some problem

 

** Changed in: python-quantities
       Status: Fix Committed => Fix Released

-- 
inch unit causes some problem
https://bugs.launchpad.net/bugs/313143
You received this bug notification because you are a member of Python
Quantities Development Team, which is subscribed to python-quantities.

Status in Physical Quantities for Python: Fix Released

Bug description:
The inch unit causes some problems. I am not sure exactly why inch is causing problems, but I believe it is related to the fact that the display unit for inch is "in" and that at some point a python parser is called. If this is changed to "inch" I do not see any errors. 

>>> [6, 8] * inch

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    [6, 8] * inch
  File "quantities/quantity.py", line 222, in __repr__
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy-1.3.0.dev5934-py2.5-macosx-10.3-i386.egg/numpy/core/numeric.py", line 1135, in array_str
    return array2string(a, max_line_width, precision, suppress_small, ' ', "", str)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy-1.3.0.dev5934-py2.5-macosx-10.3-i386.egg/numpy/core/arrayprint.py", line 287, in array2string
    separator, prefix)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy-1.3.0.dev5934-py2.5-macosx-10.3-i386.egg/numpy/core/arrayprint.py", line 216, in _array2string
    _summaryEdgeItems, summary_insert)[:-1]
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy-1.3.0.dev5934-py2.5-macosx-10.3-i386.egg/numpy/core/arrayprint.py", line 330, in _formatArray
    word = format_function(a[-i]) + separator
  File "quantities/quantity.py", line 227, in __getitem__
  File "quantities/quantity.py", line 71, in __init__
  File "quantities/parser.py", line 72, in __getitem__
  File "quantities/parser.py", line 44, in __getitem__
  File "<string>", line 1, in <module>
NameError: name 'inch' is not defined
>>> inch
1.0*in