2016-02-22 26 views
0

在运行干对俄罗斯的爱情例子中,我得到了以下错误:干不承认Tor的路径

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

为了解决这个问题,我增加了以下路径tor_cmd如超过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, 
) 

然而,它现在给我的错误:

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

当它清楚。我添加文件夹路径中列出的文件的快照: enter image description here

任何人都可以请帮我解决这个问题吗?谢谢。

编辑:我在VirtualBox上使用Ubuntu 14.04。

回答

1

~字符是一个Bash shell功能,可扩展为环境变量$HOME的值。它不适用于Python或其他编程语言。

相反,请指定Tor的完整路径,或者在Python中使用的地方创建一个指向它的链接。

+0

感谢您的回答!我实际上尝试过这样做,但它现在给了我一个完全不同的错误:'File“practice.py”,第49行,在 init_msg_handler = print_bootstrap_lines, 文件“/usr/local/lib/python2.7/dist-packages/干/ process.py “线路266,在launch_tor_with_config 返回launch_tor(tor_cmd,指定参数时,torrc_path,completion_percent,init_msg_handler,超时take_ownership) 文件” /usr/local/lib/python2.7/dist-packages/stem/ process.py“,第143行,在launch_tor中 引发OSError('进程已终止:%s'%last_problem) OSError:进程终止:超时# – QPTR

+0

您认为您可以提供帮助吗?或者,也许我应该为它创建一个单独的帖子? – QPTR

+0

刚刚在[这里]创建了一个新帖子(http://stackoverflow.com/questions/35571423/running-stem-with-tor-gives-process-terminated-timedout)。 – QPTR