相关疑难解决方法(0)

Stem给出了"无法连接到端口9051"错误

我试过这个例子:

import getpass
import sys

import stem
import stem.connection

from stem.control import Controller

if __name__ == '__main__':
  try:
    controller = Controller.from_port()
  except stem.SocketError as exc:
    print("Unable to connect to tor on port 9051: %s" % exc)
    sys.exit(1)

  try:
    controller.authenticate()
  except stem.connection.MissingPassword:
    pw = getpass.getpass("Controller password: ")

    try:
      controller.authenticate(password = pw)
    except stem.connection.PasswordAuthFailed:
      print("Unable to authenticate, password is incorrect")
      sys.exit(1)
  except stem.connection.AuthenticationFailure as exc:
    print("Unable to authenticate: %s" % exc)
    sys.exit(1)

  print("Tor is running version %s" % controller.get_version())
  controller.close() …
Run Code Online (Sandbox Code Playgroud)

python tor python-2.7 stem

5
推荐指数
1
解决办法
1694
查看次数

标签 统计

python ×1

python-2.7 ×1

stem ×1

tor ×1