Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regex usage causing error with python > 3.6 #142

Open
pingwindyktator opened this issue Aug 25, 2018 · 6 comments
Open

Regex usage causing error with python > 3.6 #142

pingwindyktator opened this issue Aug 25, 2018 · 6 comments

Comments

@pingwindyktator
Copy link

This function:

def preprocess_regex(regex):

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
Copy link

i have this issue too!

@skjortan23
Copy link

Yes this issue still remains.

@vharitonsky
Copy link

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
Copy link

still same on python3.8

@SwapnilSoni1999
Copy link

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

levcovenant added a commit to levcovenant/python-whois that referenced this issue Mar 3, 2020
@rovellipaolo
Copy link

FYI this was also fixed in @kilgoretrout1985 fork of pythonwhois: kilgoretrout1985@81abd1a
pip3 install pythonwhois-alt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants