Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 2.7 带tor的运行阀杆给出;进程终止:超时“;_Python 2.7_Ubuntu 14.04_Tor_Stem - Fatal编程技术网

Python 2.7 带tor的运行阀杆给出;进程终止:超时“;

Python 2.7 带tor的运行阀杆给出;进程终止:超时“;,python-2.7,ubuntu-14.04,tor,stem,Python 2.7,Ubuntu 14.04,Tor,Stem,当我试着用爱的例子来运行Stem到俄罗斯时,我得到了以下错误: ~$ 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/ste

当我试着用爱的例子来运行Stem到俄罗斯时,我得到了以下错误:

~$ 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
~$python practice.py
起动马达:
回溯(最近一次呼叫最后一次):
文件“practice.py”,第49行,在
init_msg_handler=print_bootstrap_行,
文件“/usr/local/lib/python2.7/dist-packages/stem/process.py”,第266行,位于launch\u-tor\u中,带有\u-config
返回启动任务(任务命令、参数、任务路径、完成百分比、初始化消息处理程序、超时、获取所有权)
文件“/usr/local/lib/python2.7/dist packages/stem/process.py”,第143行,在启动程序中
引发操作错误('进程已终止:%s'%last\u问题)
操作错误:进程已终止:超时
我最初得到的路径错误已经解决了。我尝试重新启动Ubuntu实例(我在VirtualBox中运行Ubuntu14.04),以防任何其他运行的tor发生冲突,但它会给出相同的错误。有人能帮忙吗


编辑:如果这是以任何方式连接的,我的torrc文件现在似乎也是空的

它可能会失败,因为您缺少使用特定国家/地区出口节点所需的GeoIP数据库

请尝试从python脚本中删除
'ExitNodes':“{ru}”和
行,或者因为您在Ubuntu上,请尝试
sudo apt get install to geoipdb
,看看这是否有助于连接的建立和运行

因为构建电路需要时间,所以您也可以尝试稍微增加超时(尽管这可能不是它失败的原因)


非常感谢你!!我安装了tor geoipdb包,但它仍然不起作用,但我在代码中看到了
usr/bin/tor
路径,我想知道为什么我在安装的
tor浏览器
文件夹(当我第一次安装tor时)中给出了
usr/bin/tor
的确切路径。我用了这个,它成功了!我不明白这两条路径之间有什么区别,为什么第一条路径在它也是可执行文件的路径(或者看起来是这样)时不起作用。
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,
)