I have a test program:

from sympy import symbols, Rational
m = symbols('m')
temp = Rational(0)
temp = temp.subs(m, m)
temp = 0
temp = temp.subs(m, m)
#Result in test program:
#'int' object has no attribute 'subs'
#Result in my program:
#UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa7 in position 416: 
invalid start byte

Of course, subs(m, m) doesn't make sense, but it is a special case that can 
occur and it was easier to allow it than to construct code to avoid it.

When temp is an integer 0, the error message in the test program is easy 
for me to understand: 'int' object has no attribute 'subs'
However, for some reason, when exactly the same code runs within my 
program, the error message caused my real headaches, because it was hard to 
find our exactly where it was happening: UnicodeDecodeError: 'utf-8' codec 
can't decode byte 0xa7 in position 416: invalid start byte

Now I can solve the problem easily by using Rational(0). Of course, I could 
also avoid the subs when the variable is 0, but that would be my second 
choice.

By the way, I am using Python 3.9 and Sympy 1.9 in Visual Studio 2022 on 
Windows 10, just in case anyone is interested in trying this out and making 
a comparison.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/e03ef30c-1560-4e27-bfae-386918efda93n%40googlegroups.com.

Reply via email to