joepie91 / python-whois

A python module for retrieving and parsing WHOIS data
Do What The F*ck You Want To Public License
398 stars 187 forks source link

Regex usage causing error with python > 3.6 #142

Open pingwindyktator opened 6 years ago

pingwindyktator commented 6 years ago

This function: https://github.com/joepie91/python-whois/blob/7b0ddf755b3d706860d5d8cb80c598fd854a48ca/pythonwhois/parse.py#L203 causes an error re.error: bad escape \s at position 0 when using python > 3.6. You can try it here: https://wandbox.org/permlink/D6ZEUWfMIs7wYK77 Please note, that in python 3.7: "Unknown escapes consisting of \'\' and an ASCII letter in replacement templates for re.sub() were deprecated in Python 3.5, and will now cause an error." (https://docs.python.org/3/whatsnew/3.7.html). It seems that that's the only problem with python > 3.6.

Themesfa commented 6 years ago

i have this issue too!

skjortan23 commented 5 years ago

Yes this issue still remains.

vharitonsky commented 5 years ago

Ended up doing it this way:

TARGET=/usr/local/lib/python3.7/dist-packages/pythonwhois/
cd $TARGET
sed -i 's/\(\s*regex = re.sub(r"\\\\s.*\)r"\\s\(.*\)>\\S\(.*\)/\1r"\\\\s\2>\\\\S\3/' parse.py
SwapnilSoni1999 commented 4 years ago

still same on python3.8

SwapnilSoni1999 commented 4 years ago

Ended up doing it this way:

TARGET=/usr/local/lib/python3.7/dist-packages/pythonwhois/
cd $TARGET
sed -i 's/\(\s*regex = re.sub(r"\\\\s.*\)r"\\s\(.*\)>\\S\(.*\)/\1r"\\\\s\2>\\\\S\3/' parse.py

thanks alot <3 works with 3.8

rovellipaolo commented 3 years ago

FYI this was also fixed in @kilgoretrout1985 fork of pythonwhois: https://github.com/kilgoretrout1985/pythonwhois-alt/commit/81abd1aab2a1e450d97d006327b47bf801df334a pip3 install pythonwhois-alt