Status: Accepted
Owner: asmeurer
Labels: Type-Defect Priority-High Milestone-Release0.7.0 Printing

New issue 2354 by asmeurer: isympy -o doesn't parse bad arguments correctly
http://code.google.com/p/sympy/issues/detail?id=2354

$./bin/isympy -o notarealordering
IPython console for SymPy 0.6.7-git (Python 2.7.1) (ground types: gmpy)

These commands were executed:
from __future__ import division
from sympy import *
x, y, z, t = symbols('x y z t')
k, m, n = symbols('k m n', integer=True)
f, g, h = symbols('f g h', cls=Function)

Documentation can be found at http://www.sympy.org

In [1]: x**2 + 1
Out[1]: ---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)

/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/<ipython console> in <module>()

/sw/lib/python2.7/site-packages/IPython/Prompts.pyc in __call__(self, arg)
    550
    551             # and now call a possibly user-defined print mechanism

--> 552             manipulated_val = self.display(arg)
    553
554 # user display hooks can change the variable to be stored in


/sw/lib/python2.7/site-packages/IPython/Prompts.pyc in _display(self, arg)
    576             return IPython.generics.result_display(arg)
    577         except TryNext:
--> 578             return self.shell.hooks.result_display(arg)
    579
    580     # Assign the default display method:


/sw/lib/python2.7/site-packages/IPython/hooks.pyc in __call__(self, *args, **kw)
    139             #print "prio",prio,"cmd",cmd #dbg

    140             try:
--> 141                 ret = cmd(*args, **kw)
    142                 return ret
    143             except ipapi.TryNext, exc:

/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/interactive/printing.pyc in result_display(self, arg)
     32         """
     33         if self.rc.pprint:
---> 34             out = stringify_func(arg)
     35
     36             if '\n' in out:

/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/printing/pretty/pretty.pyc in pretty(expr, **settings)
    864
    865     try:
--> 866         return pp.doprint(expr)
    867     finally:
    868         pretty_use_unicode(uflag)

/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/printing/pretty/pretty.pyc in doprint(self, expr)
     36
     37     def doprint(self, expr):
---> 38         return self._print(expr).render(**self._settings)
     39
     40     # empty op so _print(stringPict) returns the same


/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/printing/printer.pyc in _print(self, expr, *args)
    246                 printmethod = '_print_' + cls.__name__
    247                 if hasattr(self, printmethod):
--> 248                     return getattr(self, printmethod)(expr, *args)
    249
    250             # Unknown object, fall back to the emptyPrinter.


/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/printing/pretty/pretty.pyc in _print_Add(self, expr, order)
    497
    498     def _print_Add(self, expr, order=None):
--> 499         terms = self._as_ordered_terms(expr, order=order)
    500         pforms, indices = [], []
    501

/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/printing/printer.pyc in _as_ordered_terms(self, expr, order)
    259         if order is None:
260 return sorted(Add.make_args(expr), Basic._compare_pretty)
    261         else:
--> 262             return expr.as_ordered_terms(order=order)
    263

/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/core/expr.pyc in as_ordered_terms(self, order, data)
    254         from sympy.utilities import any
    255
--> 256         key, reverse = self._parse_order(order)
    257         terms, gens = self.as_terms()
    258

/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/core/expr.pyc in _parse_order(cls, order)
    212                 order = order[4:]
    213
--> 214         monom_key = monomial_key(order)
    215
    216         def key(term):

/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/polys/monomialtools.pyc in monomial_key(order)
    127             return _monomial_key[order]
    128         except KeyError:
--> 129 raise ValueError("supported monomial orderings are 'lex', 'grlex' and 'grevlex', got %r" % order)
    130     elif hasattr(order, '__call__'):
    131         return order

ValueError: supported monomial orderings are 'lex', 'grlex' and 'grevlex', got 'notarealordering'


isympy should give an error straightway about this. There should be one unified list of allowable ordering somewhere that all the various things can check against, to make it easier if we decide to add any new orderings.

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to sympy-issues@googlegroups.com.
To unsubscribe from this group, send email to 
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to