Suppose you insert a line of code below.
import sys
Here's what the one-line code is to be inserted into. (app.py)
1 import os
2 <insert the code snippet here>
3
4
5 sys.path.append('/code')
6 ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
Use sed / GNU sed only, try brew install gnu-sed
$ gsed -i '2i\import sys' app.py
Profit!
1 import os
2 import sys
3
4
5 sys.path.append('/code')
6 ROOT_DIR = os.path.dirname(os.path.abspath(__file__))