Indeed that should fix it, in the meantime you can run something like

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

Before running other commands to fix the problem in a given notebook 

On Friday, July 1, 2022 at 3:40:58 AM UTC+2 John H Palmieri wrote:

> This might be fixed by the change at 
> https://trac.sagemath.org/ticket/33996. That will presumably be merged in 
> the next beta release, since the ticket was just closed two days ago.
>
>
> On Thursday, June 30, 2022 at 11:30:11 AM UTC-7 Richard Stanton wrote:
>
>> I've just installed Sagemath 9.6 (Release Date: 2022-05-15) on my Mac 
>> running macOS 12.4. If I create a new Sagemath Jupyter notebook starting 
>> from Sagemath, everything seems to work fine. However, I'd like to start by 
>> just running "jupyter notebook" at the command line.  When I do this and 
>> create a new notebook, selecting Sagemath 9.6 as the kernel, the kernel 
>> starts up fine and I can run code. However, while `print(2)` correctly 
>> displays the number 2, just typing `2` results in the error message shown 
>> in the title. Any suggestions? Thanks!
>>
>> Here's the full error dump:
>>
>> {{{
>>
>> --------------------------------------------------------------------------
>> OSError                                   Traceback (most recent call 
>> last)
>> /var/folders/z_/x5g7y7vd6wqd2kzfnmfdqjjh0000gn/T/ipykernel_14807/1798176506.py
>>  
>> in <module>
>> ----> 1 Integer(2)
>>
>> /private/var/tmp/sage-9.6-current/local/var/lib/sage/venv-python3.10.3/lib/python3.10/site-packages/IPython/core/displayhook.py
>>  
>> in __call__(self, result)
>>     260             self.start_displayhook()
>>     261             self.write_output_prompt()
>> --> 262             format_dict, md_dict = 
>> self.compute_format_data(result)
>>     263             self.update_user_ns(result)
>>     264             self.fill_exec_result(result)
>>
>> /private/var/tmp/sage-9.6-current/local/var/lib/sage/venv-python3.10.3/lib/python3.10/site-packages/IPython/core/displayhook.py
>>  
>> in compute_format_data(self, result)
>>     149 
>>     150         """
>> --> 151         return self.shell.display_formatter.format(result)
>>     152 
>>     153     # This can be set to True by the write_output_prompt method 
>> in a subclass
>>
>> /private/var/tmp/sage-9.6-current/local/var/lib/sage/venv-python3.10.3/lib/python3.10/site-packages/sage/repl/display/formatter.py
>>  
>> in format(self, obj, include, exclude)
>>     186             I am repper
>>     187         """
>> --> 188         sage_format, sage_metadata = self.dm.displayhook(obj)
>>     189         assert PLAIN_TEXT in sage_format, 'plain text is always 
>> present'
>>     190 
>>
>> /private/var/tmp/sage-9.6-current/local/var/lib/sage/venv-python3.10.3/lib/python3.10/site-packages/sage/repl/rich_output/display_manager.py
>>  
>> in displayhook(self, obj)
>>     825             return
>>     826         self._backend.set_underscore_variable(obj)
>> --> 827         plain_text, rich_output = 
>> self._rich_output_formatter(obj, dict())
>>     828         return self._backend.displayhook(plain_text, rich_output)
>>     829 
>>
>> /private/var/tmp/sage-9.6-current/local/var/lib/sage/venv-python3.10.3/lib/python3.10/site-packages/sage/repl/rich_output/display_manager.py
>>  
>> in _rich_output_formatter(self, obj, rich_repr_kwds)
>>     652             plain_text = self._backend.plain_text_formatter(obj, 
>> **rich_repr_kwds)
>>     653         if rich_output is None:
>> --> 654             rich_output = self._preferred_text_formatter(
>>     655                 obj, plain_text=plain_text, **rich_repr_kwds)
>>     656         # promote output container types to backend-specific 
>> containers
>>
>> /private/var/tmp/sage-9.6-current/local/var/lib/sage/venv-python3.10.3/lib/python3.10/site-packages/sage/repl/rich_output/display_manager.py
>>  
>> in _preferred_text_formatter(self, obj, plain_text, **kwds)
>>     550             return out
>>     551         if want == 'unicode_art' and OutputUnicodeArt in 
>> supported:
>> --> 552             out = self._backend.unicode_art_formatter(obj, **kwds)
>>     553             if type(out) is not OutputUnicodeArt:
>>     554                 raise OutputTypeException('backend returned wrong 
>> output type, require UnicodeArt')
>>
>> /private/var/tmp/sage-9.6-current/local/var/lib/sage/venv-python3.10.3/lib/python3.10/site-packages/sage/repl/rich_output/backend_base.py
>>  
>> in unicode_art_formatter(self, obj, **kwds)
>>     425             result = unicode_art(obj)
>>     426         from sage.repl.rich_output.output_basic import 
>> OutputUnicodeArt
>> --> 427         return OutputUnicodeArt(str(result))
>>     428 
>>     429     def latex_formatter(self, obj, **kwds):
>>
>> /private/var/tmp/sage-9.6-current/local/var/lib/sage/venv-python3.10.3/lib/python3.10/site-packages/sage/structure/sage_object.pyx
>>  
>> in sage.structure.sage_object.SageObject.__repr__ 
>> (build/cythonized/sage/structure/sage_object.c:2558)()
>>     192         except AttributeError:
>>     193             return super().__repr__()
>> --> 194         result = reprfunc()
>>     195         if isinstance(result, str):
>>     196             return result
>>
>> /private/var/tmp/sage-9.6-current/local/var/lib/sage/venv-python3.10.3/lib/python3.10/site-packages/sage/typeset/character_art.py
>>  
>> in _repr_(self)
>>     153             hsize = MAX_WIDTH
>>     154         else:
>> --> 155             hsize = self._terminal_width()
>>     156         # if the draw is larger than the max length, try to split 
>> it
>>     157         if hsize <= self._l and self._breakpoints:
>>
>> /private/var/tmp/sage-9.6-current/local/var/lib/sage/venv-python3.10.3/lib/python3.10/site-packages/sage/typeset/character_art.py
>>  
>> in _terminal_width(self)
>>     281         import termios
>>     282         import struct
>> --> 283         rc = fcntl.ioctl(int(0), termios.TIOCGWINSZ,
>>     284                          struct.pack('HHHH', sys.stdout.fileno(), 
>> 0, 0, 0))
>>     285         h, w, hp, wp = struct.unpack('HHHH', rc)
>>
>> OSError: [Errno 25] Inappropriate ioctl for device
>>
>> }}}
>>
>>
>>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/2eb1dfc4-5151-4cef-b07c-351b8ede59fdn%40googlegroups.com.

Reply via email to