Use code.interact instead of py -i.

This commit is contained in:
voussoir 2020-02-19 13:15:03 -08:00
parent 31517a41d2
commit e25c6e8697

View file

@ -1,6 +1,3 @@
# Use with
# py -i etiquette_easy.py
import logging import logging
handler = logging.StreamHandler() handler = logging.StreamHandler()
log_format = '{levelname}:etiquette.{module}.{funcName}: {message}' log_format = '{levelname}:etiquette.{module}.{funcName}: {message}'
@ -8,6 +5,7 @@ handler.setFormatter(logging.Formatter(log_format, style='{'))
logging.getLogger().addHandler(handler) logging.getLogger().addHandler(handler)
import argparse import argparse
import code
import os import os
import sys import sys
import traceback import traceback
@ -33,12 +31,16 @@ def photag(photo_id):
print(photo.get_tags()) print(photo.get_tags())
while True: while True:
photo.add_tag(input('> ')) photo.add_tag(input('> '))
get = P.get_tag get = P.get_tag
################################################################################
def erepl_argparse(args): def erepl_argparse(args):
if args.exec_statement: if args.exec_statement:
exec(args.exec_statement) exec(args.exec_statement)
else:
import code
code.interact(banner='', local=dict(globals(), **locals()))
def main(argv): def main(argv):
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()