我正在开发一个使用stem创建3个Tor实例的脚本,从stem教程“to Russia with love”。
def print_bootstrap_lines(line):
if "Bootstrapped " in line:
print(term.format(line, term.Color.BLUE))
def main():
SocksPort=9050
#print(str(SocksPort))
i=0
while i<2:
tor_process=stem.process.launch_tor_with_config(
config={
'SocksPort':str(SocksPort),
'ControlPort':str(SocksPort+1),
'ExitNodes':'{ru}',
'StrictNodes':'1',},
init_msg_handler=print_bootstrap_lines,
)
SocksPort=SocksPort+2
i=i+1
创建第一个实例后,将打印返回错误:
OSError: Process terminated: No, it's still there. Exiting.