Skip to content
Advertisement

Every time I run my script it returns `_curses.error: must call setupterm() first` why?

I’m currently trying to learn pwn in python. I wrote a simple Hello world script:

JavaScript

and let it run. Immediately two errors returned stating:

JavaScript

I’ve looked around and found that the solution ought to be stating:

JavaScript

Now, export doesn’t seem to be a valid command and placing a forward-slash after an equals sign returns the error 'expression expected'. I’m using pycharm on ubuntu 20.04.

My question then is where do I put the export code?

Advertisement

Answer

In order to run pwntools scripts in non-pty IDEs, the best way is to disable pwntools terminal interaction. This can be done by setting PWNLIB_NOTREM to 1 in the environment. Example from inside the script:

JavaScript

The same way you can set up other environment variables, like the TERM you mentioned. export TERM=linux is a POSIX shell syntax (or bash syntax), while the python syntax for setting an environment variable like this would be:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement