0

I was importing pwntools in google colab but this error stops pwntools from importing:

UnsupportedOperation                      Traceback (most recent call last)
<ipython-input-2-6911e2dbc5cd> in <cell line: 1>()
----> 1 from pwn import *
      2 import numpy as np
      3 
      4 p = process('./moon')
      5 

10 frames
/usr/local/lib/python3.9/dist-packages/pwn/__init__.py in <module>
      2 from __future__ import absolute_import
      3 
----> 4 from pwn.toplevel import *
      5 
      6 pwnlib.args.initialize()

/usr/local/lib/python3.9/dist-packages/pwn/toplevel.py in <module>
     20 from pprint import pprint
     21 
---> 22 import pwnlib
     23 from pwnlib import *
     24 from pwnlib.asm import *

/usr/local/lib/python3.9/dist-packages/pwnlib/__init__.py in <module>
     39 ]
     40 
---> 41 from . import args

/usr/local/lib/python3.9/dist-packages/pwnlib/args.py in <module>
     58 import sys
     59 
---> 60 from pwnlib import term
     61 from pwnlib.context import context
     62 

/usr/local/lib/python3.9/dist-packages/pwnlib/term/__init__.py in <module>
      4 import sys
      5 
----> 6 from pwnlib.term import completer
      7 from pwnlib.term import key
      8 from pwnlib.term import keymap

/usr/local/lib/python3.9/dist-packages/pwnlib/term/completer.py in <module>
      5 import re
      6 
----> 7 from pwnlib.term import readline
      8 
      9 

/usr/local/lib/python3.9/dist-packages/pwnlib/term/readline.py in <module>
     10 from pwnlib.term import keymap as km
     11 from pwnlib.term import term
---> 12 from pwnlib.term import text
     13 
     14 cursor = text.reverse

/usr/local/lib/python3.9/dist-packages/pwnlib/term/text.py in <module>
    128 
    129 tether = sys.modules[__name__]
--> 130 sys.modules[__name__] = Module()

/usr/local/lib/python3.9/dist-packages/pwnlib/term/text.py in __init__(self)
     42             'white': 7,
     43             }
---> 44         self._reset = termcap.get('reset')
     45         self._attributes = {}
     46         for x, y in [('italic'   , 'sitm'),

/usr/local/lib/python3.9/dist-packages/pwnlib/term/unix_termcap.py in get(cap, *args, **kwargs)
     23 
     24     if cache is None:
---> 25         init()
     26     s = cache.get(cap)
     27     if not s:

/usr/local/lib/python3.9/dist-packages/pwnlib/term/unix_termcap.py in init()
     57         # Fix for BPython
     58         try:
---> 59             curses.setupterm()
     60         except curses.error as e:
     61             import traceback

UnsupportedOperation: fileno

I never had any problem with importing any library in google colab

I looked up failed to import pwntools in google colab in google and found this issue but it was not helpful. the error was similar but I did not understand what and how. I want an explanation of the error and how to solve this error.

M Z
  • 4,571
  • 2
  • 13
  • 27
gr007
  • 21
  • 3
  • Linked issue sort of explains that if you set PWNLIB_NOTERM to 1 before the import, it might work. something like `%env PWNLIB_NOTERM=1` ? – rasjani Apr 27 '23 at 07:36
  • @rasjani where do i put this? i tried adding a code block and adding it there. but it does not work. – gr007 Apr 27 '23 at 08:08

0 Answers0