How to start with stem?

1.5k Views Asked by At

I'm newbie in stem (Tor framework in python). I have windows 10 64 bit with python27 installed and stem library and Tor browser. When I want to start my first code as below:

import sys

from stem.connection import connect

if __name__ == '__main__':
  controller = connect()

  if not controller:
    sys.exit(1)  # unable to get a connection

  print 'Tor is running version %s' % controller.get_version()
  controller.close()

I get this error: Unable to connect to tor. Are you sure it's running? enter image description here Please help me what must I do.

1

There are 1 best solutions below

0
On

You need to install Tor not just the Tor Browser. I'm unsure if that is possible for Windows or not, I've never done it. I've set it up on an Ubuntu machine and it's pretty simple. https://tor.stackexchange.com/questions/3534/setting-up-tor-for-use-with-stem this post seems useful to you also this should be useful to https://www.torproject.org/docs/debian.html.en