Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TOR with Python (stem) hanging on initialization

I'm having some trouble using tor with python and I don't quite know where to go from here.

System/packages: Windows 10

Python 3.8 (via jupyter lab)

stem

tor (tor.exe added to PATH)

I'm trying to run the following code:

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
)

It outputs one line and then just sits

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

edit When I edit out the boostrap print line, I also get these warnings:

[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?

Before running I made sure there were no tor.exe processes going, and I can confirm that it does start a tor.exe process in the task manager

I've also tried killing my firewall and that doesn't make any difference.

Any suggestions of how to proceed/next steps? I'm at a loss for what to try next.

Thanks!

like image 329
flyingmeatball Avatar asked Nov 22 '25 07:11

flyingmeatball


1 Answers

The issue was an outdated old install in [username]/appdata/roaming/tor. I had moved the directory I installed Tor to, but didn't know to clear that folder first. Once I deleted that and reinstalled Tor browser, everything ran correctly.

like image 65
flyingmeatball Avatar answered Nov 24 '25 19:11

flyingmeatball



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!