erdiaker / torrequest

Simple Python interface for HTTP(s) requests over Tor
235 stars 42 forks source link

OSError: 'tor' isn't available on your system. Maybe it's not in your PATH? #2

Closed bondeanikets closed 6 years ago

bondeanikets commented 6 years ago

from torrequest import TorRequest

with TorRequest() as tr: response = tr.get('http://ipecho.net/plain') print(response.text)

Traceback (most recent call last):

File "", line 4, in with TorRequest() as tr:

File "C:\Users\anike\Anaconda3\lib\site-packages\torrequest.py", line 21, in init self._tor_proc = self._launch_tor()

File "C:\Users\anike\Anaconda3\lib\site-packages\torrequest.py", line 46, in _launch_tor take_ownership=True)

File "C:\Users\anike\Anaconda3\lib\site-packages\stem\process.py", line 285, in launch_tor_with_config return launch_tor(tor_cmd, args, torrc_path, completion_percent, init_msg_handler, timeout, take_ownership)

File "C:\Users\anike\Anaconda3\lib\site-packages\stem\process.py", line 98, in launch_tor raise OSError("'%s' isn't available on your system. Maybe it's not in your PATH?" % tor_cmd)

OSError: 'tor' isn't available on your system. Maybe it's not in your PATH?

erdiaker commented 6 years ago

Hi,

Did you install Tor? It's not packaged with torrequest library, you should install it separately. If you use homebrew you can try brew install tor. Or sudo apt-get install tor on a debian based system.

sushant580 commented 6 years ago

Tor installed but still getting this error raise OSError("'%s' isn't available on your system. Maybe it's not in your PATH?" % tor_cmd)

OSError: 'tor' isn't available on your system. Maybe it's not in your PATH?

nakulmole commented 5 years ago

First you need to install support libs. (like torrequests).

for WINDOWS OS you need to install TorBrowser from TorBrowser

1.Install it and copy PATH=C:\Users\nakul\Desktop\Tor Browser\Browser\TorBrowser\Tor\tor.exe. (I installed it on desktop you copy your location)

  1. Open process.py file C:\Python27\Lib\site-packages\stem\process.py

  2. Goto line no. 204(change 'tor' to '..\tor'.exe path)

Code Before: def launch_tor_with_config(config, tor_cmd = 'tor', completion_percent = 100, init_msg_handler = None, timeout = DEFAULT_INIT_TIMEOUT, take_ownership = False, close_output = True):

Code After Update: def launch_tor_with_config(config, tor_cmd = 'C:\Users\nakul\Desktop\Tor Browser\Browser\TorBrowser\Tor\tor.exe', completion_percent = 100, init_msg_handler = None, timeout = DEFAULT_INIT_TIMEOUT, take_ownership = False, close_output = True):

It working for me, best of luck.

bituritesh commented 3 years ago

@Nakul8087 your answer is right except for windows the path is separated by \\ not \ tor_cmd = 'C:\\Users\\nakul\\Desktop\\Tor Browser\\Browser\\TorBrowser\\Tor\\tor.exe'

nakulmole commented 3 years ago

@Nakul8087 your answer is right except for windows the path is separated by \ not \ tor_cmd = 'C:\Users\nakul\Desktop\Tor Browser\Browser\TorBrowser\Tor\tor.exe'

Windows ignores double backslashes. So backslash \ is correct and you should use that one, but double backslash \ \ works too.

ArtyomMaiorov commented 1 year ago

@nakulmole how to make the changes in process.py file persist?