[GRASS-SVN] r71005 - grass-addons/grass7/general/g.cloud

svn_grass at osgeo.org svn_grass at osgeo.org
Tue May 2 19:05:45 PDT 2017


Author: wenzeslaus
Date: 2017-05-02 19:05:45 -0700 (Tue, 02 May 2017)
New Revision: 71005

Modified:
   grass-addons/grass7/general/g.cloud/g.cloud.py
Log:
g.cloud: pexpect not need in the main file, lazy import ssh (sub)module

Modified: grass-addons/grass7/general/g.cloud/g.cloud.py
===================================================================
--- grass-addons/grass7/general/g.cloud/g.cloud.py	2017-05-03 01:47:05 UTC (rev 71004)
+++ grass-addons/grass7/general/g.cloud/g.cloud.py	2017-05-03 02:05:45 UTC (rev 71005)
@@ -108,7 +108,7 @@
 #%end
 
 # import library
-import os, sys, pexpect, tarfile, ast, tempfile, getpass, itertools, collections, stat
+import os, sys, tarfile, ast, tempfile, getpass, itertools, collections, stat
 from types import *
 import grass.script as grass
 
@@ -126,11 +126,9 @@
 if cloudpath:
     sys.path.append(cloudpath)
 
-try:
-    import cloud_ssh as sshs
-except ImportError:
-    pass
+# lazy imports cloud_ssh
 
+
 def transposed(lists):
     """ Function to transpose list of variables """
     if not lists: return []
@@ -291,6 +289,8 @@
 	    return 0
     # server option
     server = options['server']
+    # lazy import
+    import cloud_ssh as sshs
     # create the sshs session
     ssh_conn = sshs.ssh_session(user, server, session_path, passwd)
     if flags['a']:



More information about the grass-commit mailing list