stem not recognizing tor's path

不羁的心 提交于 2019-12-12 02:57:36

问题


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:

Could anyone please help me resolve this problem? Thanks.

EDIT: I am using Ubuntu 14.04 on VirtualBox.


回答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.



来源:https://stackoverflow.com/questions/35552724/stem-not-recognizing-tors-path

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!