ascii_art fail in jupyter notebook

85 views
Skip to first unread message

Jianping Pan

unread,
Jun 13, 2022, 6:13:23 PM6/13/22
to sage-support
SageMath version 9.7.beta1, Release Date: 2022-05-26
Operating system: macOS Monterey 12.4

When running sage in Jupyter notebook, I get the following problem.

sage: ascii_art(list(Partitions(5)))
<repr(<sage.typeset.ascii_art.AsciiArt at 0x7f8f358aa250>) failed: OSError: [Errno 25] Inappropriate ioctl for device>

The exact same code works when I run my sage in the terminal. My guess is the "_terminal_width()" private method does not work with Jupiter. In the terminal, the following command gives

sage: ascii_art(list(Partitions(5)))._terminal_width()
80

While in Jupiter notebook I get 
OSError: [Errno 25] Inappropriate ioctl for device 

This was not an issue before I recently upgraded my sage.

Thanks!

Jianping Pan

unread,
Jun 14, 2022, 3:58:46 PM6/14/22
to sage-support
The above error can be fixed by setting

sage: sage.typeset.ascii_art.AsciiArt._terminal_width = lambda x: 80

(80 or any other width you want)

Kwankyu

unread,
Jun 14, 2022, 8:31:58 PM6/14/22
to sage-support
Thanks for the report.

This is now fixed in 

Reply all
Reply to author
Forward
0 new messages