Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 1310 by mussadique: Complex numbers break print_mathml
http://code.google.com/p/sympy/issues/detail?id=1310

using the latest sympy version (0.6.3),

if I were to create a symbol y=sqrt(-5) and then try to display it with
either print_mathml(y) or print_gtk(y), I get this error(for print_mathml):

====================================================START CODE

In [24]: print_mathml(y)
---------------------------------------------------------------------------
exceptions.TypeError                                 Traceback (most recent
call last)

/home/user/<ipython console>

/usr/lib/python2.4/site-packages/sympy/printing/mathml.py in  
print_mathml(expr)
     154                 x
     155         </ci>
     156     </apply>
     157     """
--> 158     print mathml(expr)

/usr/lib/python2.4/site-packages/sympy/printing/mathml.py in mathml(expr)
     136     """Returns the MathML representation of expr"""
     137     s = MathMLPrinter()
--> 138     return s.doprint(sympify(expr))
     139
     140 def print_mathml(expr):

/usr/lib/python2.4/site-packages/sympy/printing/mathml.py in doprint(self,  
e)
      15
      16     def doprint(self, e):
---> 17         return self._print(e).toprettyxml()
      18
      19     def mathml_tag(self, e):

/usr/lib/python2.4/site-packages/sympy/printing/printer.py in _print(self,
expr, *args)
     141             printmethod = '_print_' + cls.__name__
     142             if hasattr(self, printmethod):
--> 143                 res = getattr(self, printmethod)(expr, *args)
     144                 if res is None:
     145                     raise Exception("Printing method '%s' did
return None" % printmethod)

/usr/lib/python2.4/site-packages/sympy/printing/mathml.py in
_print_AssocOp(self, e)
     130         x.appendChild(x_1)
     131         for arg in e.args:
--> 132             x.appendChild(self._print(arg))
     133         return x
     134

/usr/lib/python2.4/site-packages/sympy/printing/printer.py in _print(self,
expr, *args)
     141             printmethod = '_print_' + cls.__name__
     142             if hasattr(self, printmethod):
--> 143                 res = getattr(self, printmethod)(expr, *args)
     144                 if res is None:
     145                     raise Exception("Printing method '%s' did
return None" % printmethod)

/usr/lib/python2.4/site-packages/sympy/printing/mathml.py in
_print_Basic(self, e)
     121     def _print_Basic(self, e):
     122         x = self.dom.createElement(self.mathml_tag(e))
--> 123         for arg in e:
     124             x.appendChild(self._print(arg))
     125         return x

TypeError: iteration over non-sequence

=============================================== END CODE

the print_gtk error is similar.

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
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