Status: Accepted
Owner: asmeurer
Labels: Type-Defect Priority-Medium Matrices Printing

New issue 2653 by asmeurer: pretty printing an empty matrix is broken
http://code.google.com/p/sympy/issues/detail?id=2653

In [4]: a
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (3, 0))

Out[4]: ---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/Users/aaronmeurer/Documents/python/sympy/sympy/<ipython-input-4-60b725f10c9c> in <module>()
----> 1 a

/Users/aaronmeurer/Documents/ipython/IPython/core/displayhook.pyc in __call__(self, result)
    300             self.start_displayhook()
    301             self.write_output_prompt()
--> 302             format_dict = self.compute_format_data(result)
    303             self.write_format_data(format_dict)
    304             self.update_user_ns(result)

/Users/aaronmeurer/Documents/ipython/IPython/core/displayhook.pyc in compute_format_data(self, result)
    213             MIME type representation of the object.
    214         """
--> 215         return self.shell.display_formatter.format(result)
    216
    217     def write_format_data(self, format_dict):

/Users/aaronmeurer/Documents/ipython/IPython/core/formatters.py in format(self, obj, include, exclude)
    123                     continue
    124             try:
--> 125                 data = formatter(obj)
    126             except:
    127                 # FIXME: log the exception


/Users/aaronmeurer/Documents/ipython/IPython/core/formatters.py in __call__(self, obj)
    444                 type_pprinters=self.type_printers,
    445                 deferred_pprinters=self.deferred_printers)
--> 446             printer.pretty(obj)
    447             printer.flush()
    448             return stream.getvalue()

/Users/aaronmeurer/Documents/ipython/IPython/lib/pretty.pyc in pretty(self, obj)
    341             for cls in _get_mro(obj_class):
    342                 if cls in self.type_pprinters:
--> 343 return self.type_pprinters[cls](obj, self, cycle)
    344                 else:
    345                     printer = self._in_deferred_types(cls)

/Users/aaronmeurer/Documents/python/sympy/sympy/sympy/interactive/printing.pyc in pretty_print(arg, p, cycle)
     25     def pretty_print(arg, p, cycle):
     26         """caller for pretty, for use in IPython 0.11"""
---> 27         p.text(stringify_func(arg))
     28
     29     def result_display(self, arg):

/Users/aaronmeurer/Documents/python/sympy/sympy/sympy/printing/pretty/pretty.pyc in pretty(expr, **settings)
   1231
   1232     try:
-> 1233         return pp.doprint(expr)
   1234     finally:
   1235         pretty_use_unicode(uflag)

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


/Users/aaronmeurer/Documents/python/sympy/sympy/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/sympy/printing/pretty/pretty.pyc in _print_Matrix(self, e)
    459
    460         for j in range(M.cols):
--> 461             maxw[j] = max([Ms[i,j].width()  for i in range(M.rows)])
    462
    463

ValueError: max() arg is an empty sequence

The string printer works just fine, though.

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

Reply via email to