[spp] [PATCH 1/3] controller: move import websocket

ogawa.yasufumi at lab.ntt.co.jp ogawa.yasufumi at lab.ntt.co.jp
Mon Apr 23 08:22:35 CEST 2018


From: ogawa.yasufumi at lab.ntt.co.jp

From: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>

To avoid error for a user who does not install websocket, move import
statement from top of the file into to_http method which calls
websocket.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>
---
 src/controller/topo.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/controller/topo.py b/src/controller/topo.py
index 76dd54f..aa81e03 100644
--- a/src/controller/topo.py
+++ b/src/controller/topo.py
@@ -8,7 +8,6 @@ from spp_common import logger
 import subprocess
 import traceback
 import uuid
-import websocket
 import yaml
 
 
@@ -250,6 +249,7 @@ class Topo(object):
         subprocess.call("rm -f %s" % tmpfile, shell=True)
 
     def to_http(self, sec_list):
+        import websocket
         tmpfile = "%s.dot" % uuid.uuid4().hex
         self.to_dot(sec_list, tmpfile)
         msg = open(tmpfile).read()
-- 
2.13.1




More information about the spp mailing list