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

[tor-commits] [stem/master] Fixing circular import



commit fc736ff07c2ded068ee3e5b9ad1028923ee89c47
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Fri Aug 17 10:07:55 2012 -0700

    Fixing circular import
    
    Correcting a circular import between the connection and control modules...
    
    >>> import test.prompt
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "test/prompt.py", line 15, in <module>
        import stem.control
      File "stem/control.py", line 48, in <module>
        import stem.connection
      File "stem/connection.py", line 106, in <module>
        def connect_port(control_addr = "127.0.0.1", control_port = 9051, password = None, chroot_path = None, controller = stem.control.Controller):
    AttributeError: 'module' object has no attribute 'control'
---
 stem/control.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/stem/control.py b/stem/control.py
index 0d7bb04..aca6f41 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -45,7 +45,6 @@ import time
 import Queue
 import threading
 
-import stem.connection
 import stem.response
 import stem.socket
 import stem.version
@@ -646,6 +645,7 @@ class Controller(BaseController):
     :raises: see :func:`stem.connection.authenticate`
     """
     
+    import stem.connection
     stem.connection.authenticate(self, *args, **kwargs)
   
   def protocolinfo(self):
@@ -659,6 +659,7 @@ class Controller(BaseController):
       * :class:`stem.socket.SocketError` if problems arise in establishing or using the socket
     """
     
+    import stem.connection
     return stem.connection.get_protocolinfo(self)
   
   def get_conf(self, param, default = UNDEFINED, multiple = False):



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits