Ask Your Question

Inappropriate ioctl for device

asked 2022-04-25 19:08:44 +0200

Annavw gravatar image

I am trying to run

%display unicode_art


In the terminal, this works fine, but in the jupyter notebook I get the error "Inappropriate ioctl for device". There are also issues for any other entry using unicode art.

I am on Sage 9.5, Ubuntu 22.04, and Firefox 99.0.1 (installed as .deb not as snap).

edit retag flag offensive close merge delete


unicode art is made for the terminal. For jupyter, we may need to use something from

FrédéricC gravatar imageFrédéricC ( 2022-04-26 11:29:51 +0200 )edit

%display latex is more appropriate for the Jupyter notebook --- well, not for Partitions(5).list()...

eric_g gravatar imageeric_g ( 2022-04-27 17:10:23 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2022-04-27 13:44:32 +0200

FrédéricC gravatar image

Here is a partial traceback

As you can see, this comes from asking about the terminal width..

----> 6         print(self.p._unicode_art_())
~/sage/local/lib/python3.9/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

~/sage/local/lib/python3.9/site-packages/sage/typeset/ 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:

~/sage/local/lib/python3.9/site-packages/sage/typeset/ 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
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2022-04-25 19:08:44 +0200

Seen: 37 times

Last updated: Apr 27