title: stem - can't get new ip with python via tor
body: <p>I'm trying to get a new IP in a tor session using stem and the following function which is heavily 'inspired' by <a href="https://stackoverflow.com/a/25166100/2488942">this answer</a>:</p>
  
  <pre><code>def get_new_IP():
      socket.socket = old_socket
      with Controller.from_port(port=SOCKS_PORT) as controller:
          controller.authenticate()
          controller.signal(Signal.NEWNYM)
      socket.socket = socks.socksocket
  </code></pre>
  
  <p>However I get the error 'IncorrectSocketType: unable to use the control socket' raised by <code>controller.authenticate()</code> which leaves me a little lost since there is no password or anything specified and the initial connection I set up works too.</p>
  
  <p>I have also tried to add <code>'CookieAuthentication': str(1)</code>, <a href="https://stackoverflow.com/questions/15459170/trouble-authenticating-tor-with-python">as suggested here</a>, to the config settings when starting the tor process, however that didn't work either. </p>
  
  <p>How come that the initial connection works and why can't I get authenticated when I try to reconnect?</p>