Ask Your Question
0

Inappropriate ioctl for device

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

Annavw gravatar image

I am trying to run

%display unicode_art

Partitions(5).list()

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

Comments

unicode art is made for the terminal. For jupyter, we may need to use something from https://ipython.readthedocs.io/en/sta...

FrédéricC gravatar imageFrédéricC ( 2022-04-26 11:29:51 +0100 )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 +0100 )edit

1 Answer

Sort by » oldest newest most voted
0

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

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/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:

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

Stats

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

Seen: 756 times

Last updated: Apr 27 '22