首页 > 解决方案 > TOR与Python(茎)挂在初始化

问题描述

我在 python 中使用 tor 时遇到了一些麻烦,我不太清楚从这里去哪里。

系统/软件包:Windows 10

Python 3.8(通过 jupyter 实验室)

tor(tor.exe 添加到 PATH)

我正在尝试运行以下代码:

import stem

proxy_port = 9050
def print_bootstrap_lines(line):
  if "Bootstrapped " in line:
    print(line)

tor = stem.process.launch_tor_with_config(
  config = {
    'SocksPort': str(proxy_port) },
  init_msg_handler = print_bootstrap_lines, take_ownership=True
)

它输出一行然后就坐

Oct 23 15:00:22.000 [notice] Bootstrapped 0% (starting): Starting

编辑 当我编辑出 boostrap 打印行时,我还会收到以下警告:

[warn] Path for GeoIPFile (<default>) is relative and will resolve to D:\projects\Valuator\<default>. Is this what you wanted?
Oct 29 08:44:26.812 [warn] Path for GeoIPv6File (<default>) is relative and will resolve to D:\projects\Valuator\<default>. Is this what you wanted?

在运行之前,我确保没有运行 tor.exe 进程,并且我可以确认它确实在任务管理器中启动了一个 tor.exe 进程

我也试过杀死我的防火墙,但这没有任何区别。

关于如何进行/下一步的任何建议?我不知道下一步该尝试什么。

谢谢!

标签: pythonwindowstor

解决方案


问题是 [username]/appdata/roaming/tor 中的过时旧安装。我已经移动了安装 Tor 的目录,但不知道先清除该文件夹。一旦我删除它并重新安装 Tor 浏览器,一切都正常运行。


推荐阅读