Open rvanrosmalen opened 2 years ago
Is it possible the wiki content has a \R
in it?
It looks like the other regex issue that is with \A. So with that information:
It looks like it is new_path variable which has the value Wiki\Requirements in my case. It must be the \R in that string (and I guess for the other issue it is Wiki\A....
Should that string be escaped then or should be \ become /?
Changed a line and it works: new_path = os.path.join(os.sep.join(all_pages.get(link_new)[1]), f"{link_new}.md").replace("\", "/")
Exporting the wiki gives me this error:
Traceback (most recent call last): File "C:\Users\rro\AppData\Local\Programs\Python\Python38\lib\sre_parse.py", line 1039, in parse_template this = chr(ESCAPES[this][1]) KeyError: '\R'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Users\rro\AzureDevops\redmine-azure-devops-migrate\wiki.py", line 69, in
main()
File "C:\Users\rro\AzureDevops\redmine-azure-devops-migrate\wiki.py", line 61, in main
content = re.sub(rf"[[{link.group('link')}]]", f"{link.group('link')}", content)
File "C:\Users\rro\AppData\Local\Programs\Python\Python38\lib\re.py", line 210, in sub
return _compile(pattern, flags).sub(repl, string, count)
File "C:\Users\rro\AppData\Local\Programs\Python\Python38\lib\re.py", line 327, in _subx
template = _compile_repl(template, pattern)
File "C:\Users\rro\AppData\Local\Programs\Python\Python38\lib\re.py", line 318, in _compile_repl
return sre_parse.parse_template(repl, pattern)
File "C:\Users\rro\AppData\Local\Programs\Python\Python38\lib\sre_parse.py", line 1042, in parse_template
raise s.error('bad escape %s' % this, len(this))
re.error: bad escape \R at position 20
Staring at that line but don't see yet what is wrong?