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

SyntaxWarning: invalid escape sequence '\(' #146

Open
Turranius opened this issue Apr 8, 2024 · 1 comment
Open

SyntaxWarning: invalid escape sequence '\(' #146

Turranius opened this issue Apr 8, 2024 · 1 comment

Comments

@Turranius
Copy link

`# ./megaclisas-status
/root/./megaclisas-status:475: SyntaxWarning: invalid escape sequence '['
dsize = re.sub(" [..$", "", dsize)
/root/./megaclisas-status:491: SyntaxWarning: invalid escape sequence '('
subfstate = re.sub("(.", "", fstate)
/root/./megaclisas-status:533: SyntaxWarning: invalid escape sequence '('
temp = re.sub(" (.
)", "", temp)
/root/./megaclisas-status:537: SyntaxWarning: invalid escape sequence '['
cmd = "%s pdrbld -showprog -physdrv[%s:%s] -a%d -NoLog" % (megaclipath, enclid, slotid, controllerid)
/root/./megaclisas-status:582: SyntaxWarning: invalid escape sequence '['
dsize = re.sub(" [..$", "", dsize)
/root/./megaclisas-status:592: SyntaxWarning: invalid escape sequence '('
subfstate = re.sub("(.", "", fstate)
/root/./megaclisas-status:633: SyntaxWarning: invalid escape sequence '('
temp = re.sub("(.
)", "", temp)
/root/./megaclisas-status:830: SyntaxWarning: invalid escape sequence '('
if re.match("|".join(["^Online$", "^Online, Spun Up$", "^Rebuilding (.*"]), array[5]):
-- Controller information --
-- ID | H/W Model | RAM | Temp | BBU | Firmware
c0 | PERC H800 Adapter | 512MB | N/A | Good | FW: 12.10.7-0001

This happened when upgrading from Fedora 37 to 39 just now. I have to use double escape chars to make it work.

For example
dsize = re.sub(" \[.*\.*$", "", dsize)
fixed with
dsize = re.sub(" \\[.*\\.*$", "", dsize)

hlein added a commit to hlein/hwraid that referenced this issue Jun 23, 2024
Only regexes that include escapes and such cause errors, but use r""
everywhere for consistency.

Closes: eLvErDe#146
Signed-off-by: Hank Leininger <hlein@korelogic.com>
@hlein
Copy link

hlein commented Jun 23, 2024

@Turranius if you are able, please try #147 , especially if you have more hw varieties than I do.

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

2 participants