commit 085bdd31cb9e916d0d86edccd7bf4199da173870
Author: aagbsn <aagbsn(a)extc.org>
Date: Fri Sep 16 15:49:07 2011 -0700
2018 - better error messages
Wraps custom library imports in try/except, and
adds error messages in format:
"""
TorCtl not found in os.path.abspath($cwd/../..)
Exiting...
"""
---
NetworkScanners/ExitAuthority/libsoat.py | 8 +++++++-
NetworkScanners/ExitAuthority/snakeinspector.py | 8 +++++++-
NetworkScanners/ExitAuthority/soat.py | 10 ++++++++--
NetworkScanners/ExitAuthority/soat_config.py | 8 +++++++-
NetworkScanners/ExitAuthority/soatstats.py | 10 ++++++++--
5 files changed, 37 insertions(+), 7 deletions(-)
diff --git a/NetworkScanners/ExitAuthority/libsoat.py b/NetworkScanners/ExitAuthority/libsoat.py
index c4be677..153d80f 100644
--- a/NetworkScanners/ExitAuthority/libsoat.py
+++ b/NetworkScanners/ExitAuthority/libsoat.py
@@ -24,7 +24,13 @@ from soat import Tag, SoupStrainer
from soat_config import *
sys.path.append("../../")
-from TorCtl.TorUtil import *
+try:
+ from TorCtl.TorUtil import *
+except ImportError:
+ from os import getcwd, path
+ print "TorCtl not found in %s" % path.abspath(getcwd()+'../..')
+ print "Exiting..."
+ exit()
# Antlr stuff
sys.path.append("../libs/jsparser/")
diff --git a/NetworkScanners/ExitAuthority/snakeinspector.py b/NetworkScanners/ExitAuthority/snakeinspector.py
index cf1edfe..45250b6 100755
--- a/NetworkScanners/ExitAuthority/snakeinspector.py
+++ b/NetworkScanners/ExitAuthority/snakeinspector.py
@@ -22,7 +22,13 @@ from libsoat import *
from soat_config import *
sys.path.append("../../")
-import TorCtl.TorUtil
+try:
+ import TorCtl.TorUtil
+except ImportError:
+ from os import getcwd, path
+ print "TorCtl not found in %s" % path.abspath(getcwd()+'../..')
+ print "Exiting..."
+ exit()
TorCtl.TorUtil.loglevel="INFO"
diff --git a/NetworkScanners/ExitAuthority/soat.py b/NetworkScanners/ExitAuthority/soat.py
index 4db34a2..2355dea 100755
--- a/NetworkScanners/ExitAuthority/soat.py
+++ b/NetworkScanners/ExitAuthority/soat.py
@@ -78,8 +78,14 @@ from libsoat import *
from soat_config import *
sys.path.append("../../")
-from TorCtl import TorUtil, TorCtl, PathSupport, ScanSupport
-from TorCtl.TorUtil import plog
+try:
+ from TorCtl import TorUtil, TorCtl, PathSupport, ScanSupport
+ from TorCtl.TorUtil import plog
+except ImportError:
+ from os import getcwd, path
+ print "TorCtl not found in %s" % path.abspath(getcwd()+'../..')
+ print "Exiting..."
+ exit()
sys.path.insert(0,"../libs")
# Make our SocksiPy use our socket
diff --git a/NetworkScanners/ExitAuthority/soat_config.py b/NetworkScanners/ExitAuthority/soat_config.py
index 6beba50..fa36658 100644
--- a/NetworkScanners/ExitAuthority/soat_config.py
+++ b/NetworkScanners/ExitAuthority/soat_config.py
@@ -8,7 +8,13 @@
import sys
sys.path.append("../../")
-from TorCtl.PathSupport import *
+try:
+ from TorCtl.PathSupport import *
+except ImportError:
+ from os import getcwd, path
+ print "TorCtl not found in %s" % path.abspath(getcwd()+'../..')
+ print "Exiting..."
+ exit()
from soat import BeautifulSoup
diff --git a/NetworkScanners/ExitAuthority/soatstats.py b/NetworkScanners/ExitAuthority/soatstats.py
index db12c48..ab790e5 100755
--- a/NetworkScanners/ExitAuthority/soatstats.py
+++ b/NetworkScanners/ExitAuthority/soatstats.py
@@ -15,8 +15,14 @@ if sys.version_info < (2, 5):
import libsoat
from libsoat import *
-sys.path.append("../")
-from TorCtl.TorUtil import *
+sys.path.append("../../")
+try:
+ from TorCtl.TorUtil import *
+except ImportError:
+ from os import getcwd, path
+ print "TorCtl not found in %s" % path.abspath(getcwd()+'../..')
+ print "Exiting..."
+ exit()
class ResultCount:
def __init__(self, type):