[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r13157: Adjust import paths to find TorCtl in the parent directory, (torflow/trunk/tools)



Author: mikeperry
Date: 2008-01-17 01:57:50 -0500 (Thu, 17 Jan 2008)
New Revision: 13157

Modified:
   torflow/trunk/tools/moniTor.py
Log:

Adjust import paths to find TorCtl in the parent directory, 
and only import TorCtl and TorUtil in case GeoIP and other
unneeded dependencies are not installed.




Modified: torflow/trunk/tools/moniTor.py
===================================================================
--- torflow/trunk/tools/moniTor.py	2008-01-17 06:43:32 UTC (rev 13156)
+++ torflow/trunk/tools/moniTor.py	2008-01-17 06:57:50 UTC (rev 13157)
@@ -35,8 +35,15 @@
 
 import curses
 import time
-from TorCtl import *
+import sys
+import socket
 
+# Hack.. Can also set PYTHONPATH..
+# http://docs.python.org/tut/node8.html#searchPath
+sys.path.append('../')
+from TorCtl import TorCtl, TorUtil
+from TorCtl.TorCtl import *
+
 # Parse authenticate string from file here
 
 #moniTorConf = "/etc/moniTor.conf"
@@ -47,7 +54,7 @@
 
     #moniTorConf = "/etc/moniTor.conf"
     #authSecret = open(moniTorConf).read().strip()
-    authSecret = ""
+    #authSecret = ""
 
     return
 
@@ -86,7 +93,7 @@
   sh,sp = parseHostAndPort(sys.argv[1])
 
   torctl_oracle, torctl_oracle_thread = create_oracle(sh,sp)
-  static_info, static_keys, = collect_status(torctl_oracle) 
+  static_info, static_keys, = collect_status(torctl_oracle)
 
   # Number of connections, current bw
   dynamic_keys = ['version', 'config-file', 'address', 'fingerprint']