Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when use pause() inside ipython #1441

Closed
Cirn09 opened this issue Mar 4, 2020 · 1 comment
Closed

Error when use pause() inside ipython #1441

Cirn09 opened this issue Mar 4, 2020 · 1 comment
Labels
term This is connected to pwnlib.term module

Comments

@Cirn09
Copy link

Cirn09 commented Mar 4, 2020

Python 3.7.3 (default, Dec 20 2019, 18:57:59)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.13.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from pwn import *
In [2]: pause()
[*] Paused (press enter to continue)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-7822ce9e65ea> in <module>
----> 1 pause()

/usr/local/lib/python3.7/dist-packages/pwnlib/ui.py in pause(n)
    281         else:
    282             log.info('Paused (press enter to continue)')
--> 283             raw_input('')
    284     elif isinstance(n, six.integer_types):
    285         with log.waitfor("Waiting") as l:

/usr/local/lib/python3.7/dist-packages/pwnlib/term/readline.py in raw_input(prompt, float)
    434                      bottom of the screen when `term.term_mode` is enabled.
    435     """
--> 436     return readline(None, prompt, float)
    437
    438 def str_input(prompt='', float=True):

/usr/local/lib/python3.7/dist-packages/pwnlib/term/readline.py in readline(_size, prompt, float, priority)
    380     if not term_mode:
    381         six.print_(prompt, end='', flush=True)
--> 382         return sys.stdin.readline(_size).rstrip('\n')
    383     show_suggestions = False
    384     eof = False

TypeError: 'NoneType' object cannot be interpreted as an integer

it's easy to fix, just modify pwnlib.term.readline.raw_input:

def raw_input(prompt='', float=True):
    ...
    return readline(None, prompt, float)

to

def raw_input(prompt='', float=True):
    ...
    return readline(-1, prompt, float)
@Arusekk Arusekk added the term This is connected to pwnlib.term module label Mar 16, 2020
@Arusekk
Copy link
Member

Arusekk commented Apr 28, 2021

Closed in #1659 or #1632.

@Arusekk Arusekk closed this as completed Apr 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
term This is connected to pwnlib.term module
Projects
None yet
Development

No branches or pull requests

2 participants