question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Regex usage causing error with python > 3.6

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:6
  • Comments:6

github_iconTop GitHub Comments

7reactions
vharitonskycommented, Nov 7, 2018

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
3reactions
Themesfacommented, Sep 19, 2018

i have this issue too!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Regular expression split fails on 3.6 and not 2.7 or 3.7+
I am receiving an unexpected behavior in using regular expressions for splitting a string. It seems like this error exists in `python 3.6` ......
Read more >
6.2. re — Regular expression operations — Python 3.6.3 ...
Specifies that exactly m copies of the previous RE should be matched; fewer matches cause the entire RE not to match. For example,...
Read more >
Invalid syntax using regular expression in python 3.6.8
regular expression working in mac but giving error in linux. Linux has all python package but version is different.
Read more >
An Empirical Study on Regular Expression Bugs - Chris Brown
Since Python version 3.6, re.LOCALE can be used only with bytes patterns. ... the root cause is the regex, the regex itself caused...
Read more >
Python re Module - Regex Support - Regular-Expressions.info
Python's re module can use Unicode strings. So you could pass the Unicode string u"\u00E0\\d" to the re module to match à followed...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found