AttributeError on calling sage.misc.log.log_text() in SageMath 8.9

26 views
Skip to first unread message

Max Alekseyev

unread,
Oct 30, 2019, 10:21:34 AM10/30/19
to sage-devel
Please advise on the following error.
Thanks,
Max

┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.9, Release Date: 2019-09-29                     │
│ Using Python 2.7.15. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
sage: import sage.misc.log
sage: sage.misc.log.log_text()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-ace4f1da0972> in <module>()
----> 1 sage.misc.log.log_text()

/usr/local/SageMath.89/local/lib/python2.7/site-packages/sage/misc/log.pyc in __init__(self, dir, debug, viewer)
     97         self._dir = dir
     98         self._filename = os.path.join(dir, self._filename())
---> 99         self._output = __IPYTHON__.output_hist
    100         self._input  = __IPYTHON__.input_hist_raw
    101         self._text = ''

AttributeError: 'bool' object has no attribute 'output_hist'

Dima Pasechnik

unread,
Oct 30, 2019, 12:19:23 PM10/30/19
to sage-devel
This is a bug
See https://trac.sagemath.org/ticket/28677
Thanks for reporting it - it's a good example of code bitrot due to no
tests... :-)
> --
> You received this message because you are subscribed to the Google Groups "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/dcd4e90d-5af8-416f-9c4b-243677f5835a%40googlegroups.com.

Dima Pasechnik

unread,
Oct 30, 2019, 12:30:49 PM10/30/19
to sage-devel
In fact, sage/misc/log.py uses very old ipython features, which seem
to be long gone.
A modern way to say e.g. the whole command history to /tmp/xxx.log
would be to run

sage: %history -f /tmp/xxx.log
See
https://stackoverflow.com/questions/16858724/how-to-log-ipython-history-to-text-file/39413200
for more details

HTH
Dima
Reply all
Reply to author
Forward
0 new messages