sympy-live icon indicating copy to clipboard operation
sympy-live copied to clipboard

Category theory examples from https://docs.sympy.org/latest/modules/categories.html fail on SymPy Live

Open catskillsresearch opened this issue 4 years ago • 4 comments

This example code given on the website fails on SymPy Live in https://docs.sympy.org/latest/modules/categories.html:

>>> from sympy.categories import Object, NamedMorphism
Exception in SymPy Live of type 
<type 'exceptions.TypeError'>
for reference the last 5 stack trace entries are
Traceback (most recent call last):
  File "/base/data/home/apps/s~sympy-live-hrd/66.426491309333028408/app/handlers.py", line 271, in post
    live.evaluate(statement, session, printer, stream)
  File "/base/data/home/apps/s~sympy-live-hrd/66.426491309333028408/app/shell.py", line 284, in evaluate
    session_globals_dict = session.globals_dict()
  File "/base/data/home/apps/s~sympy-live-hrd/66.426491309333028408/app/models.py", line 87, in globals_dict
    for name, val in zip(self.global_names, self.globals))
  File "/base/data/home/apps/s~sympy-live-hrd/66.426491309333028408/app/models.py", line 87, in <genexpr>
    for name, val in zip(self.global_names, self.globals))
  File "/base/alloc/tmpfs/dynamic_runtimes/python27g/32fc9e2909a8cd9/python27/python27_dist/lib/python2.7/pickle.py", line 1388, in loads
    return Unpickler(file).load()
TypeError: name should be a string, not <class 'sympy.core.symbol.Symbol'>

catskillsresearch avatar Aug 10 '20 03:08 catskillsresearch

Does it fail if you try again? I just tried and it worked fine

oscarbenjamin avatar Aug 10 '20 11:08 oscarbenjamin

On my work PC, which is Windows 10. It fails on the first example. On my home PC, which is Ubuntu, the first example works, and the 2nd one fails, in the same way as I initially reported:

TypeError: name should be a string, not <class 'sympy.core.symbol.Symbol'>

This happens with g * f, here is full context:

>>> (g * f).domain
Exception in SymPy Live of type 
<type 'exceptions.TypeError'>
for reference the last 5 stack trace entries are
Traceback (most recent call last):
  File "/base/data/home/apps/s~sympy-live-hrd/66.426491309333028408/app/handlers.py", line 271, in post
    live.evaluate(statement, session, printer, stream)
  File "/base/data/home/apps/s~sympy-live-hrd/66.426491309333028408/app/shell.py", line 284, in evaluate
    session_globals_dict = session.globals_dict()
  File "/base/data/home/apps/s~sympy-live-hrd/66.426491309333028408/app/models.py", line 87, in globals_dict
    for name, val in zip(self.global_names, self.globals))
  File "/base/data/home/apps/s~sympy-live-hrd/66.426491309333028408/app/models.py", line 87, in <genexpr>
    for name, val in zip(self.global_names, self.globals))
  File "/base/alloc/tmpfs/dynamic_runtimes/python27g/32fc9e2909a8cd9/python27/python27_dist/lib/python2.7/pickle.py", line 1388, in loads
    return Unpickler(file).load()
TypeError: name should be a string, not <class 'sympy.core.symbol.Symbol'>

Please see attached screenshot for visual confirmation. Screenshot from 2020-08-10 07-46-56

catskillsresearch avatar Aug 10 '20 11:08 catskillsresearch

Okay now I see it. It's the second example on that doc page that fails

oscarbenjamin avatar Aug 10 '20 12:08 oscarbenjamin

Also Piecewise functions in Elementary. So basically the whole thing is probably busted:

https://docs.sympy.org/latest/modules/functions/elementary.html

catskillsresearch avatar Aug 13 '20 22:08 catskillsresearch