1
votes

While trying to run Stem's To Russia With Love example, I am getting the following error:

~$ python practice.py

Starting Tor:

Traceback (most recent call last):
  File "practice.py", line 49, in <module>
    init_msg_handler = print_bootstrap_lines,
  File "/usr/local/lib/python2.7/dist-packages/stem/process.py", line 266, in launch_tor_with_config
    return launch_tor(tor_cmd, args, torrc_path, completion_percent, init_msg_handler, timeout, take_ownership)
  File "/usr/local/lib/python2.7/dist-packages/stem/process.py", line 143, in launch_tor
    raise OSError('Process terminated: %s' % last_problem)
OSError: Process terminated: Timed out

I was initially getting the path error that was solved over here. I tried restarting the Ubuntu instance (I am running Ubuntu 14.04 in VirtualBox) just in case if any other running tor was conflicting but its giving the same error. Could anyone please help?

EDIT: My torrc file also seems to be empty right now if this is in any way connected.

1

1 Answers

2
votes

It might be failing because you are missing the GeoIP database which is required to use an exit node from a specific country.

Try removing the 'ExitNodes': '{ru}', line from the python script, or since you're on Ubuntu, try sudo apt-get install tor-geoipdb and see if that helps get the connection up and running.

Since it takes time to build the circuits, you can try increasing the timeout a bit as well (though this probably isn't why its failing).

tor_process = stem.process.launch_tor_with_config(
  #tor_cmd = '/usr/bin/tor',
  timeout = 300,
  config = {
    'SocksPort': str(SOCKS_PORT),
#    'ExitNodes': '{ru}',
    'DataDir': '/tmp/tor',
    'Log': [
        'NOTICE file /tmp/tor.notice.log',
        'ERR file /tmp/tor.log',
    ],
  },
  init_msg_handler = print_bootstrap_lines,
)