See this file here
Add to the top of the notebook:
%load_ext autoreload
%autoreload 2
from IPython.display import display, HTML
# two columns alternate
CSS = """
.container {
display: flex;
flex-wrap: wrap;
}
.cell {
flex: 0 50%;
max-width: 50%;
}
"""
HTML('<style>{}</style>'.format(CSS))
from IPython.display import display, HTML
# input left, output right
CSS = """
.container {
display: bock;
}
.cell {
flex: 1;
display: flex;
flex-direction: row !important;
}
.input {
flex: 0 50%;
max-width: 50%;
height:200%;
}
.output_wrapper{
flex:0 50%;
}
"""
HTML('<style>{}</style>'.format(CSS))
See this
def foo_bar():
print('Foobar')
parser = argparse.ArgumentParser(prog='app')
subparsers = parser.add_subparsers()
foo = subparsers.add_parser('foo')
foo_subparsers = foo.add_subparsers()
bar = foo_subparsers.add_parser('bar')
bar.set_defaults(func=foo_bar)
args = parser.parse_args()
args.func(args)
from subprocess import Popen, PIPE, STDOUT
bytz = zf.read(f)
p = Popen(['pdftotext', '-layout', '-', '-' ], stdout=PIPE, stdin=PIPE, stderr=STDOUT)
stdout = p.communicate(input=bytz)[0]
text = stdout.decode()
import traceback
try:
...
except Exception as e:
traceback.print_stack()
traceback.print_exc()
import inspect
...
def f():
curframe = inspect.currentframe()
calframe = inspect.getouterframes(curframe, 2)
print('caller name:', calframe[1][3])
In case of os.fspath()
error, try:
LD_LIBRARY_PATH=${CONDA_PREFIX}/lib pyinstaller file.spec
pip --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org install <pkg>
If Pyenv failed to install python 3.7.X because of ModuleNotFoundError: No module named 'pyexpat', try:
SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk MACOSX_DEPLOYMENT_TARGET=10.14 pyenv install 3.7.4
env PYTHON_CONFIGURE_OPTS="--enable-framework"