While browsing about changing identity with tor I have the following script:
from TorCtl import TorCtl
conn = TorCtl.connect(controlAddr="127.0.0.1", controlPort=9051, passphrase="123")
TorCtl.Connection.send_signal(conn, "NEWNYM")
But I get this error:
Connection refused. Is the ControlPort enabled?
Traceback (most recent call last):
File "python_tor.py", line 18, in <module>
TorCtl.Connection.send_signal(conn, "NEWNYM")
TypeError: unbound method send_signal() must be called with Connection instance as first argument (got NoneType instance instead)
And What shoul be the passphrase? I have tried without passphrase the same error occurs.
I think you should do
conn.send_signal("NEWNYM")
You could try printing conn in between the calls. See if it's None. Maybe the connection failed.