Do you maybe have smart quotes around the m in the symbols arg? /c
On Friday, February 11, 2022 at 4:14:31 PM UTC-6 [email protected] wrote: > 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/8f5b152c-af01-44c1-80bd-2ef068e13530n%40googlegroups.com.
