From d1e2cb1a6d13938caf60ac43d6f160a686ca162c Mon Sep 17 00:00:00 2001 From: Marcus McCurdy Date: Mon, 26 Jan 2015 14:09:49 -0500 Subject: [PATCH] Adds start.py script to start the server and launch a new browser tab #17 --- start.py | 9 +++++++++ zeronet.py | 18 +++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 start.py diff --git a/start.py b/start.py new file mode 100644 index 00000000..b478e887 --- /dev/null +++ b/start.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python +from multiprocessing import Process +import webbrowser +import zeronet + +server = Process(target=zeronet.main) +server.start() +url = webbrowser.open("http://127.0.0.1:43110", new=2) +server.join() diff --git a/zeronet.py b/zeronet.py index 7f0e1de3..f8a83fa5 100644 --- a/zeronet.py +++ b/zeronet.py @@ -1,9 +1,13 @@ #!/usr/bin/env python -try: - from src import main - main.start() -except Exception, err: # Prevent closing - import traceback - traceback.print_exc() - raw_input("-- Error happened, press enter to close --") +def main(): + try: + from src import main + main.start() + except Exception, err: # Prevent closing + import traceback + traceback.print_exc() + raw_input("-- Error happened, press enter to close --") + +if __name__ == '__main__': + main()