I subclassed StrPrinter to define my own printing of some of my
classes, and I can't seem to make xsym("*") work.  I keep getting a
UnicodeDecodeError.  Here is a code snippet of what I'm doing:
....
                else:
                    if i == 0:
                        if isinstance(e.dict[k], Add):
                            s += '(' + print_pydy(e.dict[k])+\
                                ')' + xsym('*') + k.__str__()
                        else:
                            s += print_pydy(e.dict[k]) + '*' +
k.__str__()
                        i += 1
                    else:
....

And here is the error I'm getting:

  File "t.py", line 56, in <module>
    print 'print A[1]', Vector((1+sin(q1))*A[1])
  File "/home/luke/lib/python/pydy/pydy.py", line 254, in __str__
    return print_pydy(self)
  File "/home/luke/lib/python/pydy/pydy.py", line 1157, in print_pydy
    return pp.doprint(e)
  File "/var/lib/python-support/python2.6/sympy/printing/printer.py",
line 118, in doprint
    return self._str(self._print(expr))
  File "/var/lib/python-support/python2.6/sympy/printing/printer.py",
line 143, in _print
    res = getattr(self, printmethod)(expr, *args)
  File "/home/luke/lib/python/pydy/pydy.py", line 1102, in
_print_Vector
    unicode(')') + xsym('*') + unicode(k.__str__())
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position
11: ordinal not in range(128)


Removing the xsym('*') gets ride of the error, but then I don't get
the small dot.  I tried calling unicode() on each of the other terms
in the concatenation, but that didn't fix it.

I have search a lot online and have found many pages acknowledging
this error but none discussing how to fix it.  Does anybody know what
I need to do in order to take care of this?

Thanks,
~Luke

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

Reply via email to