internetarchive / internetarchive/snakebite-py3

Regular expression in minicluster _get_namenode_port has invalid escape sequence in python >= 3.8

Open
#24 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
26
Forks
25
PR merge metrics
No merged PRs in 30d

Description

This regular expression:
m = re.match(".*Started MiniDFSCluster -- namenode on port (\d+).*", line)

found here:
https://github.com/internetarchive/snakebite-py3/blob/master/snakebite/minicluster.py#L204

is not returning the namenode port as desired, rather NoneType, which leads to the error:
"TypeError: %d format: a number is required, not NoneType"

I suspect this is caused by python 3.8 (and above) throwing an invalid escape sequence error when encountering "\d"

I suspect the solution is to pass the regular expression as a raw string, i.e.:
m = re.match(r".*Started MiniDFSCluster -- namenode on port (\d+).*", line)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.