wpoely86 / redmine-azure-devops-migrate

script to migrate redmine issue and wiki to azure devops work items and wiki
GNU General Public License v3.0
8 stars 5 forks source link

Regex error #6

Open henrique25teles opened 2 years ago

henrique25teles commented 2 years ago

When trying to run the script I have an error on this line:

content = re.sub(rf"\[\[{link.group('link')}\]\]", f"[{link.group('link')}](/{new_path})", content)

And i'm receiving this on the console:

Traceback (most recent call last): File "C:\Python39\lib\sre_parse.py", line 1039, in parse_template this = chr(ESCAPES[this][1]) KeyError: '\A'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\workspace\wiki\wiki.py", line 70, in main() File "C:\workspace\wiki\wiki.py", line 62, in main content = re.sub(rf"[[{link.group('link')}]]", f"{link.group('link')}", content) File "C:\Python39\lib\re.py", line 210, in sub return _compile(pattern, flags).sub(repl, string, count) File "C:\Python39\lib\re.py", line 327, in _subx template = _compile_repl(template, pattern) File "C:\Python39\lib\re.py", line 318, in _compile_repl return sre_parse.parse_template(repl, pattern) File "C:\Python39\lib\sre_parse.py", line 1042, in parse_template raise s.error('bad escape %s' % this, len(this)) re.error: bad escape \A at position 24

Someone have this same issue and know how to solve this ? I'm not very familiar with python

henrique25teles commented 2 years ago

By the way I'm using wiki.py script

wpoely86 commented 2 years ago

This regex is for replacing the links of Redmine to the new ones for Azure. It seems that the string contains a \A that triggers python error? Is that correct? I'm not sure what the best solution is here. If it's only one, maybe it's the easiest to manually replace it?

rvanrosmalen commented 2 years ago

It looks like I have a similar issue but then with \R.

It looks like it is new_path variable which has the value Wiki\Requirements in my case.