1

I have a simple Python script that runs Selenium, and I have tried using Torsocks (as usual) simply like this: torsocks python script.py. However, it failed with this error:

Traceback (most recent call last):
  File "script.py", line 21, in <module>
    browser = webdriver.Firefox(options=options)
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/firefox/webdriver.py", line 163, in __init__
    log_path=service_log_path)
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/firefox/service.py", line 47, in __init__
    self, executable_path, port=port, log_file=log_file, env=env)
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/common/service.py", line 42, in __init__
    self.port = utils.free_port()
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/common/utils.py", line 37, in free_port
    free_socket.listen(5)
PermissionError: [Errno 1] Operation not permitted

Is it actually possible to use Torsocks like this?

I realize that I could send the request with SOCKS5 proxy, but I wonder if it could run using Torsocks, and if not, it would be great to get an explanation.

Samy
  • 629
  • 8
  • 22

0 Answers0