Bug 489526

Summary: Invalid Escape Sequence warnings on various python files from pykrita
Product: [Applications] krita Reporter: Charbel Nicolas <charbel>
Component: ScriptingAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: minor CC: halla
Priority: NOR    
Version First Reported In: 5.2.3-beta1   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Warnings screenshot

Description Charbel Nicolas 2024-07-01 03:28:12 UTC
Created attachment 171220 [details]
Warnings screenshot

***
If you're not sure this is actually a bug, instead post about it at https://discuss.kde.org

If you're reporting a crash, attach a backtrace with debug symbols; see https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***

SUMMARY

When launching krita I get many invalid escape sequence warnings from files on the pykrita folder....

STEPS TO REPRODUCE
1.  Launch krita from the terminal

OBSERVED RESULT

 Check all the warnings about invalid escape sequences on the python files

EXPECTED RESULT

No warnings should show

SOFTWARE/OS VERSIONS

Linux/KDE Plasma:
Arch Linux

Qt Version: 
Version (compiled): 5.15.14
Version (loaded): 5.15.14
Comment 1 Bug Janitor Service 2024-07-25 13:50:35 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/2203
Comment 2 Dmitry Kazakov 2024-07-29 07:12:49 UTC
Git commit 5d44af277b005692241a09f30e11bb0d16166823 by Dmitry Kazakov, on behalf of Freya Lupen.
Committed on 29/07/2024 at 07:12.
Pushed by dkazakov into branch 'master'.

Fix Python invalid escape sequence warnings

If Python finds a string with an invalid backslash escape such as '\*',
it will throw a Syntax or Deprecation warning. In the future this will
become an error. The fix is to use a raw string r'\*' instead, which
won't attempt to interpolate the escape sequences in the regexes.

M  +3    -3    plugins/python/comics_project_management_tools/comics_exporter.py
M  +2    -2    plugins/python/comics_project_management_tools/exporters/CPMT_ACBF_XML_Exporter.py
M  +4    -4    plugins/python/comics_project_management_tools/exporters/CPMT_po_parser.py
M  +1    -1    plugins/python/scripter/ui_scripter/editor/pythoneditor.py
M  +4    -4    plugins/python/scripter/ui_scripter/syntax/syntax.py

https://invent.kde.org/graphics/krita/-/commit/5d44af277b005692241a09f30e11bb0d16166823
Comment 3 Charbel Nicolas 2025-06-26 02:04:36 UTC
(In reply to Dmitry Kazakov from comment #2)
> Git commit 5d44af277b005692241a09f30e11bb0d16166823 by Dmitry Kazakov, on
> behalf of Freya Lupen.
> Committed on 29/07/2024 at 07:12.
> Pushed by dkazakov into branch 'master'.
> 
> Fix Python invalid escape sequence warnings
> 
> If Python finds a string with an invalid backslash escape such as '\*',
> it will throw a Syntax or Deprecation warning. In the future this will
> become an error. The fix is to use a raw string r'\*' instead, which
> won't attempt to interpolate the escape sequences in the regexes.
> 
> M  +3    -3   
> plugins/python/comics_project_management_tools/comics_exporter.py
> M  +2    -2   
> plugins/python/comics_project_management_tools/exporters/
> CPMT_ACBF_XML_Exporter.py
> M  +4    -4   
> plugins/python/comics_project_management_tools/exporters/CPMT_po_parser.py
> M  +1    -1    plugins/python/scripter/ui_scripter/editor/pythoneditor.py
> M  +4    -4    plugins/python/scripter/ui_scripter/syntax/syntax.py
> 
> https://invent.kde.org/graphics/krita/-/commit/
> 5d44af277b005692241a09f30e11bb0d16166823

I'm on krita 5.2.9 and I still see the same syntax warnings. Is this fix still not applied to Krita 5.2 series?
Comment 4 Halla Rempt 2025-07-08 08:45:13 UTC
It wasn't and that means it won't be in 5.2.10 which we will release tomorrow :-(
Comment 5 Halla Rempt 2025-07-08 08:45:30 UTC
Git commit 1b4ccb78728681da06d0232daddf686174684561 by Halla Rempt, on behalf of Freya Lupen.
Committed on 08/07/2025 at 08:44.
Pushed by rempt into branch 'krita/5.2'.

Fix Python invalid escape sequence warnings

If Python finds a string with an invalid backslash escape such as '\*',
it will throw a Syntax or Deprecation warning. In the future this will
become an error. The fix is to use a raw string r'\*' instead, which
won't attempt to interpolate the escape sequences in the regexes.
(cherry picked from commit 5d44af277b005692241a09f30e11bb0d16166823)

M  +3    -3    plugins/python/comics_project_management_tools/comics_exporter.py
M  +2    -2    plugins/python/comics_project_management_tools/exporters/CPMT_ACBF_XML_Exporter.py
M  +4    -4    plugins/python/comics_project_management_tools/exporters/CPMT_po_parser.py
M  +1    -1    plugins/python/scripter/ui_scripter/editor/pythoneditor.py
M  +4    -4    plugins/python/scripter/ui_scripter/syntax/syntax.py

https://invent.kde.org/graphics/krita/-/commit/1b4ccb78728681da06d0232daddf686174684561