Commit 17ebca59 authored by Guillaume Seguin's avatar Guillaume Seguin

Fixup argparse plumbing

parent 8e6ea9b0
......@@ -74,7 +74,8 @@ class Prontserve(pronsole.pronsole, EventEmitter):
self.settings.sensor_names = {'T': 'extruder', 'B': 'bed'}
self.settings.sensor_poll_rate = 1 # seconds
self.p.loud = kwargs['loud']
self.dry_run = kwargs['dry_run'] == True
self.dry_run = kwargs['dry_run']
self.heaptrace = kwargs['heaptrace']
self.stdout = sys.stdout
self.load_default_rc()
self.p.sendcb = self.sendcb
......@@ -150,7 +151,7 @@ class Prontserve(pronsole.pronsole, EventEmitter):
self.server.ioloop.start()
except Exception as ex:
print traceback.format_exc()
if args.heaptrace:
if self.heaptrace:
from guppy import hpy
print hpy().heap()
self.p.disconnect()
......
......@@ -4,10 +4,9 @@ import argparse
from printrun.prontserve import Prontserve
# Args
# -------------------------------------------------
if __name__ == "__main__":
# Args
# -------------------------------------------------
parser = argparse.ArgumentParser(
description='Runs a 3D printer server using the Construct Protocol'
......@@ -27,8 +26,7 @@ if __name__ == "__main__":
args = parser.parse_args()
# Server Start Up
# -------------------------------------------------
# Server Start Up
# -------------------------------------------------
if __name__ == "__main__":
prontserve = Prontserve(dry_run=args.dry_run, loud=args.loud).start()
prontserve = Prontserve(**vars(args)).start()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment