From 61d2e7bdabfdac94c533265941d4909537676f4b Mon Sep 17 00:00:00 2001 From: Samo Penic <samo.penic@gmail.com> Date: Wed, 06 Jul 2016 21:07:03 +0000 Subject: [PATCH] Fixes in python to allow Python 2.7 execution --- python/trisurf/tsmgr.py | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/python/trisurf/tsmgr.py b/python/trisurf/tsmgr.py index caff785..258f4c9 100644 --- a/python/trisurf/tsmgr.py +++ b/python/trisurf/tsmgr.py @@ -1,7 +1,7 @@ import argparse import paramiko from . import Remote -from trisurf import trisurf +from . import trisurf import socket import sys import tabulate @@ -9,9 +9,11 @@ import psutil #import http.server #import socketserver -from urllib.parse import urlparse - -from . import WebTrisurf +if sys.version_info>=(3,0): + from urllib.parse import urlparse + from . import WebTrisurf +else: + from urlparse import urlparse #import io @@ -169,7 +171,10 @@ def start_web_server(args,host): print('Server listening on port {}'.format(args['web_server'][0])) - WebTrisurf.WebServer(port=args['web_server'][0]) + if sys.version_info>=(3,0): + WebTrisurf.WebServer(port=args['web_server'][0]) + else: + print("Cannot start WebServer in python 2.7") exit(0) def perform_action(args,host): -- Gitblit v1.9.3