UnicodeEncodeError: 'utf-8' codec can't encode characters in position 26-27: surrogates not allowed

581 views
Skip to first unread message

zp liu

unread,
Sep 11, 2021, 6:58:10 AM9/11/21
to sage-support
Hola,all!
When I use the function  solve(),an error occur and I fail to find solutions.
Needing help!
CODE:
solve(x,x)

OUT:
UnicodeEncodeError Traceback (most recent call last) <ipython-input-1-6e1b29585f6f> in <module> ----> 1 solve(x,x) /opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/symbolic/relation.py in solve(f, *args, **kwds) 1041 1042 if is_Expression(f): # f is a single expression -> 1043 return _solve_expression(f, x, explicit_solutions, multiplicities, to_poly_solve, solution_dict, algorithm, domain) 1044 1045 if not isinstance(f, (list, tuple)): /opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/symbolic/relation.py in _solve_expression(f, x, explicit_solutions, multiplicities, to_poly_solve, solution_dict, algorithm, domain) 1280 1281 # from here on, maxima is used for solution -> 1282 m = ex._maxima_() 1283 P = m.parent() 1284 if explicit_solutions: /opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/symbolic/expression.pyx in sage.symbolic.expression.Expression._maxima_ (build/cythonized/sage/symbolic/expression.cpp:7963)() 1020 # Maybe not such a great idea because the "default" interface is another one 1021 from sage.calculus.calculus import maxima -> 1022 return super(Expression, self)._interface_(maxima) 1023 else: 1024 return super(Expression, self)._interface_(session) /opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/structure/sage_object.pyx in sage.structure.sage_object.SageObject._interface_ (build/cythonized/sage/structure/sage_object.c:5480)() 678 except (KeyError, ValueError): 679 pass --> 680 nm = I.name() 681 init_func = getattr(self, '_%s_init_' % nm, None) 682 if init_func is not None: /opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/misc/lazy_import.pyx in sage.misc.lazy_import.LazyImport.__getattr__ (build/cythonized/sage/misc/lazy_import.c:3876)() 326 True 327 """ --> 328 return getattr(self.get_object(), attr) 329 330 # We need to wrap all the slot methods, as they are not forwarded /opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/misc/lazy_import.pyx in sage.misc.lazy_import.LazyImport.get_object (build/cythonized/sage/misc/lazy_import.c:2436)() 188 if likely(self._object is not None): 189 return self._object --> 190 return self._get_object() 191 192 cpdef _get_object(self): /opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/misc/lazy_import.pyx in sage.misc.lazy_import.LazyImport._get_object (build/cythonized/sage/misc/lazy_import.c:2710)() 221 print(f"Option ``at_startup=True`` for lazy import {self._name} not needed anymore") 222 try: --> 223 self._object = getattr(__import__(self._module, {}, {}, [self._name]), self._name) 224 except ImportError as e: 225 if self._feature: /opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/interfaces/maxima_lib.py in <module> 88 from sage.symbolic.ring import SR 89 ---> 90 from sage.libs.ecl import EclObject, ecl_eval 91 92 from .maxima_abstract import (MaximaAbstract, MaximaAbstractFunction, /opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/libs/ecl.pyx in init sage.libs.ecl (build/cythonized/sage/libs/ecl.c:13899)() 1398 return ecl_wrap(o) 1399 -> 1400 init_ecl() /opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/libs/ecl.pyx in sage.libs.ecl.init_ecl (build/cythonized/sage/libs/ecl.c:5084)() 280 (setf (logical-pathname-translations "TMP") 281 '(("**;*.*" "%s/**/*.*"))) --> 282 """ % str_to_bytes(str(ECL_TMP)))) 283 284 # We define our own error catching eval, apply and funcall/ /opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/cpython/string.pxd in sage.cpython.string.str_to_bytes (build/cythonized/sage/libs/ecl.c:11601)() 75 if isinstance(s, bytes): 76 return s ---> 77 return _str_to_bytes(s, encoding, errors) UnicodeEncodeError: 'utf-8' codec can't encode characters in position 26-27: surrogates not allowed

David Joyner

unread,
Sep 11, 2021, 7:01:55 AM9/11/21
to SAGE support
On Sat, Sep 11, 2021 at 6:58 AM zp liu <lzp...@gmail.com> wrote:
>
> Hola,all!
> When I use the function solve(),an error occur and I fail to find solutions.
> Needing help!
> CODE:
> solve(x,x)
>

I get

sage: solve(x,x)
[x == 0]
sage: version()
'SageMath version 9.3.rc0, Release Date: 2021-03-23'

> OUT:
> UnicodeEncodeError Traceback (most recent call last) <ipython-input-1-6e1b29585f6f> in <module> ----> 1 solve(x,x) /opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/symbolic/relation.py in solve(f, *args, **kwds) 1041 1042 if is_Expression(f): # f is a single expression -> 1043 return _solve_expression(f, x, explicit_solutions, multiplicities, to_poly_solve, solution_dict, algorithm, domain) 1044 1045 if not isinstance(f, (list, tuple)): /opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/symbolic/relation.py in _solve_expression(f, x, explicit_solutions, multiplicities, to_poly_solve, solution_dict, algorithm, domain) 1280 1281 # from here on, maxima is used for solution -> 1282 m = ex._maxima_() 1283 P = m.parent() 1284 if explicit_solutions: /opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/symbolic/expression.pyx in sage.symbolic.expression.Expression._maxima_ (build/cythonized/sage/symbolic/expression.cpp:7963)() 1020 # Maybe not such a great idea because the "default" interface is another one 1021 from sage.calculus.calculus import maxima -> 1022 return super(Expression, self)._interface_(maxima) 1023 else: 1024 return super(Expression, self)._interface_(session) /opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/structure/sage_object.pyx in sage.structure.sage_object.SageObject._interface_ (build/cythonized/sage/structure/sage_object.c:5480)() 678 except (KeyError, ValueError): 679 pass --> 680 nm = I.name() 681 init_func = getattr(self, '_%s_init_' % nm, None) 682 if init_func is not None: /opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/misc/lazy_import.pyx in sage.misc.lazy_import.LazyImport.__getattr__ (build/cythonized/sage/misc/lazy_import.c:3876)() 326 True 327 """ --> 328 return getattr(self.get_object(), attr) 329 330 # We need to wrap all the slot methods, as they are not forwarded /opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/misc/lazy_import.pyx in sage.misc.lazy_import.LazyImport.get_object (build/cythonized/sage/misc/lazy_import.c:2436)() 188 if likely(self._object is not None): 189 return self._object --> 190 return self._get_object() 191 192 cpdef _get_object(self): /opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/misc/lazy_import.pyx in sage.misc.lazy_import.LazyImport._get_object (build/cythonized/sage/misc/lazy_import.c:2710)() 221 print(f"Option ``at_startup=True`` for lazy import {self._name} not needed anymore") 222 try: --> 223 self._object = getattr(__import__(self._module, {}, {}, [self._name]), self._name) 224 except ImportError as e: 225 if self._feature: /opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/interfaces/maxima_lib.py in <module> 88 from sage.symbolic.ring import SR 89 ---> 90 from sage.libs.ecl import EclObject, ecl_eval 91 92 from .maxima_abstract import (MaximaAbstract, MaximaAbstractFunction, /opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/libs/ecl.pyx in init sage.libs.ecl (build/cythonized/sage/libs/ecl.c:13899)() 1398 return ecl_wrap(o) 1399 -> 1400 init_ecl() /opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/libs/ecl.pyx in sage.libs.ecl.init_ecl (build/cythonized/sage/libs/ecl.c:5084)() 280 (setf (logical-pathname-translations "TMP") 281 '(("**;*.*" "%s/**/*.*"))) --> 282 """ % str_to_bytes(str(ECL_TMP)))) 283 284 # We define our own error catching eval, apply and funcall/ /opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/cpython/string.pxd in sage.cpython.string.str_to_bytes (build/cythonized/sage/libs/ecl.c:11601)() 75 if isinstance(s, bytes): 76 return s ---> 77 return _str_to_bytes(s, encoding, errors) UnicodeEncodeError: 'utf-8' codec can't encode characters in position 26-27: surrogates not allowed
>
> --
> You received this message because you are subscribed to the Google Groups "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/703453dd-b0ca-4cc5-b741-953f178695a0n%40googlegroups.com.

Emmanuel Charpentier

unread,
Sep 12, 2021, 5:02:07 AM9/12/21
to sage-support
I can't reproduce your problem on 9.5.beta0 installed from source on Debian testing running on core i7 + 16 GB RAM.
  • What version of Sage do you use ?
  • On which platform ?
  • How did-you install-it ?
This information is decessary to try to understand and diagnose your problem.

Emmanuel Charpentier

unread,
Sep 12, 2021, 5:06:42 AM9/12/21
to sage-support
Le dimanche 12 septembre 2021 à 11:02:07 UTC+2, Emmanuel Charpentier a écrit :
I can't reproduce your problem on 9.5.beta0 installed from source on Debian testing running on core i7 + 16 GB RAM.
  • What version of Sage do you use ?
  • On which platform ?
  • How did-you install-it ?
This information is decessary to try to understand and diagnose your problem.

I forgot to add :
  • What platform did you use (notebook, command line, emacs, etc...) ?
Reply all
Reply to author
Forward
0 new messages