torproject / stem

Python controller library for Tor
https://stem.torproject.org/
GNU Lesser General Public License v3.0
260 stars 75 forks source link

Client usage tutorial incompatable with some SocksiPy versions #38

Open atagar opened 4 years ago

atagar commented 4 years ago

Migrated from ticket 10522.

Our client usage tutorial (​To Russia With Love) is reportedly incompatible with certain SocksiPy versions.

The tutorial works with the standard SocksiPy Version 1.4.2 as well as Version 1.0 but not version ​1.01...

Socks5:

[...]
  File "/usr/lib64/python2.7/site-packages/socks.py", line 163, in sendall
    if 'encode' in dir(bytes):
RuntimeError: maximum recursion depth exceeded while calling a Python object

Socks4:

[...]
  File "/usr/lib64/python2.7/site-packages/socks.py", line 399, in connect
    self.__negotiatesocks4(destpair[0],destpair[1])
  File "/usr/lib64/python2.7/site-packages/socks.py", line 313, in __negotiatesocks4
    req = "\x04\x01" + struct.pack(">H",destport).decode() + ipaddr
UnicodeDecodeError: 'ascii' codec can't decode byte 0xbb in position 1: ordinal not in range(128)