From dcc8ec7fcc986a624c5bd4003e586bd0a59fd1f6 Mon Sep 17 00:00:00 2001 From: Chris Kerr Date: Sat, 16 Mar 2019 13:50:50 +0100 Subject: [PATCH] Fix 'invalid escape sequence' warnings --- galvani/BioLogic.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/galvani/BioLogic.py b/galvani/BioLogic.py index df954d2..a34ad13 100644 --- a/galvani/BioLogic.py +++ b/galvani/BioLogic.py @@ -70,7 +70,8 @@ def MPTfile(file_or_path): if magic != b'EC-Lab ASCII FILE\r\n': raise ValueError("Bad first line for EC-Lab file: '%s'" % magic) - nb_headers_match = re.match(b'Nb header lines : (\d+)\s*$', next(mpt_file)) + # TODO use rb'string' here once Python 2 is no longer supported + nb_headers_match = re.match(b'Nb header lines : (\\d+)\\s*$', next(mpt_file)) nb_headers = int(nb_headers_match.group(1)) if nb_headers < 3: raise ValueError("Too few header lines: %d" % nb_headers) @@ -107,7 +108,7 @@ def MPTfileCSV(file_or_path): if magic.rstrip() != 'EC-Lab ASCII FILE': raise ValueError("Bad first line for EC-Lab file: '%s'" % magic) - nb_headers_match = re.match('Nb header lines : (\d+)\s*$', next(mpt_file)) + nb_headers_match = re.match(r'Nb header lines : (\d+)\s*$', next(mpt_file)) nb_headers = int(nb_headers_match.group(1)) if nb_headers < 3: raise ValueError("Too few header lines: %d" % nb_headers)