0

While running Stem's To Russia With Love example, I got the following error:

'tor' isn't available on your system. Maybe it's not in your PATH

To solve this, I added the following path to tor_cmd as shown in the example over here:

tor_process = stem.process.launch_tor_with_config(
  tor_cmd = '~/Downloads/tor-browser_en-US/Browser/TorBrowser/Tor/tor',
  config = {
    'SocksPort': str(SOCKS_PORT),
    'ExitNodes': '{ru}',
  },
  init_msg_handler = print_bootstrap_lines,
)

However, its now giving me the error:

OSError: '~/Downloads/tor-browser_en-US/Browser/TorBrowser/Tor/tor' doesn't exist

when it clearly does. I am adding the snapshot of the listed files in the folder path: enter image description here

Could anyone please help me resolve this problem? Thanks.

EDIT: I am using Ubuntu 14.04 on VirtualBox.

Community
  • 1
  • 1
QPTR
  • 1,620
  • 7
  • 26
  • 47

1 Answers1

1

The ~ character is a Bash shell feature that expands to the value of the environment variable $HOME. It doesn't work in Python or other programming languages.

Instead, specify the the full path to Tor, or create a link to it somewhere in the $PATH Python is using in that case.

drew010
  • 68,777
  • 11
  • 134
  • 162
  • Thanks for the answer! I actually tried doing this but its now giving me a completely different error: `File "practice.py", line 49, in 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` – QPTR Feb 23 '16 at 07:14
  • Do you think you could help? Or maybe I should create a separate post for it? – QPTR Feb 23 '16 at 07:14
  • Just created a new post over [here](http://stackoverflow.com/questions/35571423/running-stem-with-tor-gives-process-terminated-timed-out). – QPTR Feb 23 '16 at 07:37