Hi all,

Need some help in writing python script for establishing connection in stem tor using the method 

controller.new_circuit() or controller.extend_circuit()

I tried this 

from stem import CircStatus
from stem.control import Controller

with Controller.from_port() as controller:
  controller.authenticate()

relay_ip_addresses = ["10.0.0.21","10.0.0.22","10.0.0.23"]

circuit_id = controller.extend_circuit('0',relay_ip_addresses)

But i am getting Socket already closed exception. Am i right with the syntax of the same. The thing i am trying to achieve is that i want tor to choose the following ip addresses for 

1. 10.0.0.21 for entry
2. 10.0.0.22 for middle nodes
3. 10.0.0.23 for exit nodes

I need tor chose only these three ip nodes as the relay. I have to run this inside CORE Emulator to simulate TOR in CORE. Expecting a reply soon. Thanks in advance for the help. 

Thanks and regards
Aravindan