Skip to content

overuse of Python2 quoting #70

@fizwit

Description

@fizwit

Python3 no longer allows the syntax: backslash period to search for a period. Additionally, not all Python sources have python3 shebang

SyntaxWarning: invalid escape sequence '\.'

Sample fix for internals/python/cli.py

--- shapemapper2-2.3.orig/internals/python/cli.py       2024-11-22 13:54:45.000000000 -0800
+++ shapemapper2-2.3/internals/python/cli.py    2025-05-20 14:33:43.102406000 -0700
@@ -222,7 +222,7 @@
             sub_name=arg_dict['name']
             try:
                files = os.listdir(pipeline.out)
-               n7_message_file_regex =  "\." + sub_name + ".*_n7message.txt"
+               n7_message_file_regex =  "." + sub_name + ".*_n7message.txt"
                for f in files:
                   if re.findall(n7_message_file_regex, f) != []:
                      n7_message_file = pipeline.out + "/" + f
@@ -231,9 +231,9 @@
                   if "low N7" in warnings:
                      to_remove = []

-                     mod_ga_regex = sub_name + "_Modified.*\.mutga"
-                     unt_ga_regex = sub_name + "_Untreated.*\.mutga"
-                     txt_ga_regex =   "^[^.]*" + sub_name + ".*" + "profile\.txtga"
+                     mod_ga_regex = sub_name + "_Modified.*.mutga"
+                     unt_ga_regex = sub_name + "_Untreated.*.mutga"
+                     txt_ga_regex =   "^[^.]*" + sub_name + ".*" + "profile.txtga"
                      for f in files:
                         #if f.find(".mutga") != -1:
                         if re.findall(mod_ga_regex, f) != []:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions