I'm using Windows 10. I have Tor Win32 Service actively running.
Here is my torrc file from C:...\Tor Browser\Browser\TorBrowser\Data\Tor\torrc
ControlPort 9051
CookieAuthentication 1
CacheDirectoryGroupReadable 1
Here is my python 3.9 code:
from stem import Signal
from stem.control import Controller
with Controller.from_port(port = 9051) as controller:
controller.authenticate()
controller.signal(Signal.NEWNYM)
Running the script generates this stack trace:
Traceback (most recent call last):
File "<input>", line 2, in <module>
File "C:\Users\Shaun\PycharmProjects\scm-hunter-analysis\venv\lib\site-packages\stem\control.py", line 1112, in authenticate
stem.connection.authenticate(self, *args, **kwargs)
File "C:\Users\Shaun\PycharmProjects\scm-hunter-analysis\venv\lib\site-packages\stem\connection.py", line 629, in authenticate
raise auth_exc
File "C:\Users\Shaun\PycharmProjects\scm-hunter-analysis\venv\lib\site-packages\stem\connection.py", line 591, in authenticate
authenticate_safecookie(controller, cookie_path, False)
File "C:\Users\Shaun\PycharmProjects\scm-hunter-analysis\venv\lib\site-packages\stem\connection.py", line 904, in authenticate_safecookie
cookie_data = _read_cookie(cookie_path, True)
File "C:\Users\Shaun\PycharmProjects\scm-hunter-analysis\venv\lib\site-packages\stem\connection.py", line 1085, in _read_cookie
raise UnreadableCookieFile(exc_msg, cookie_path, is_safecookie)
stem.connection.UnreadableCookieFile: Authentication failed: '/run/tor/control.authcookie' doesn't exist
Why can't I authenticate using stem? The error message confuses me because I have no idea where the run directory is.
I tried setting CookieAuthentication 0
, restarting the service, then resetting CookieAuthentication 1
and restarting. It generates the same error.