def main() -> None: # Load config.py config_filepath = os.path.join(conf.get_data_dir(), 'config.py') if os.path.isfile(config_filepath): conf.load_overrides_from_file(config_filepath) # Run try: run(sys.argv[1:]) except (KeyboardInterrupt, Exception) as exc: from .file_utils import get_dated_tmp_path import traceback exc_filepath = get_dated_tmp_path('exception') with open(exc_filepath, 'w') as f: f.write('======= Exception ====\n') f.write(str(exc) + '\n\n') f.write('======= Traceback ====\n') f.write(traceback.format_exc()) if isinstance(exc, PheWebError): print('\n\n') print(exc) elif isinstance(exc, KeyboardInterrupt): print('\nInterrupted') elif isinstance(exc, SyntaxError): print(repr(exc)) else: print('\nAn exception occurred') print('(Details in {})\n'.format(exc_filepath)) exit(1)
def configure(argv:List[str]) -> None: for i, arg in enumerate(argv): if '=' not in arg: break k,v = arg.split('=', 1) try: v = json.loads(v) except json.JSONDecodeError: pass conf.set_override(k, v) else: print(json.dumps(conf.overrides, indent=2)) return run(argv[i:])
def configure(argv): from .conf_utils import conf import json for i, arg in enumerate(argv): if '=' not in arg: break k,v = arg.split('=', 1) try: conf[k] = json.loads(v) except json.JSONDecodeError: conf[k] = v else: print(conf) exit(1) run(argv[i:])
def configure(argv): from .conf_utils import conf import json for i, arg in enumerate(argv): if '=' not in arg: break k, v = arg.split('=', 1) try: conf[k] = json.loads(v) except json.JSONDecodeError: conf[k] = v else: print(conf) exit(1) run(argv[i:])
def main(): from .utils import PheWebError try: run(sys.argv[1:]) except (KeyboardInterrupt, Exception) as exc: from .file_utils import get_dated_tmp_path import traceback exc_filepath = get_dated_tmp_path('exception') with open(exc_filepath, 'w') as f: f.write(traceback.format_exc()) if isinstance(exc, PheWebError): print(exc) elif isinstance(exc, KeyboardInterrupt): print('\nInterrupted') else: print('\nAn exception occurred') print('(Details in {})\n'.format(exc_filepath)) exit(1)
def main(): from .utils import PheWebError try: run(sys.argv[1:]) except (KeyboardInterrupt, Exception) as exc: from .file_utils import get_dated_tmp_path import traceback exc_filepath = get_dated_tmp_path('exception') with open(exc_filepath, 'w') as f: f.write('======= Exception ====\n') f.write(str(exc) + '\n\n') f.write('======= Traceback ====\n') f.write(traceback.format_exc()) if isinstance(exc, PheWebError): print(exc) elif isinstance(exc, KeyboardInterrupt): print('\nInterrupted') elif isinstance(exc, SyntaxError): print(repr(exc)) else: print('\nAn exception occurred') print('(Details in {})\n'.format(exc_filepath)) exit(1)
def serve(argv:List[str]) -> None: from pheweb.serve.run import run run(argv)
def serve(argv): from pheweb.serve.run import run run(argv)
def help(argv): run(argv[0:1] + ['-h'])
def ipdb(argv): enable_ipdb() run(argv)
def quick(argv): enable_quick() run(argv)
def debug(argv): enable_debug() run(argv)
def help(argv): run(argv[0:1] + ['-h'])
def ipdb(argv): enable_ipdb() run(argv)
def serve(argv): from pheweb.serve.run import run run(argv)