You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Success message with "→" crashes backup reporting on Windows #992
On Windows, the backup success message in export.py:82 contains → (U+2192), which cannot be encoded by Windows console encodings that lack this character, including at least cp1251 (Russian locale) and cp1252 (Western European locale).
This causes a UnicodeEncodeError inside the try block - caught by the outer except and reported as "backup failed" - even though shutil.copy2 already copied the files successfully. The backup works, but looks like it didn't.
Fix
Add sys.stdout.reconfigure(encoding='utf-8') at the top of backup_if_protected() to preserve the → symbol and ensure correct rendering on all platforms regardless of system locale.
Alternatively, replace → with -> on line 82 of export.py.
Environment
Windows 11, Russian locale (cp1251)
Python 3.13
graphifyy 0.8.16
Note
The UnicodeEncodeError is triggered specifically by the print on line 82 (success message), but the same issue would affect any print containing → or other non-cp1251/cp1252 characters on Windows. Using sys.stdout.reconfigure(encoding='utf-8') as a fix would cover all such cases in the codebase at once, rather than patching individual print statements.
changed the title [-]backup_if_protected silently fails on Windows due to → in print statement[/-][+]Success message with "→" crashes backup reporting on Windows[/+]on May 23, 2026
The bug is back in 0.8.26, this time in export.py rather than __main__.py.
The previous fix replaced → in __main__.py, but missed export.py, line 89:
print(f"[graphify] backed up {reason} graph ({copied} files) → {backup_dir.name}/")
This UnicodeEncodeError is caught by the broad except Exception on line 91 - the same handler that catches real backup failures - so the backup is falsely reported as failed even though shutil.copy2 already finished successfully.
Fixing symbols file by file doesn't scale - any future →, —, ✓, or emoji in any print() call across any module will hit the same issue on Windows.
Suggested permanent fix - two lines at the top of main() in __main__.py:
This covers all modules in one place and never needs to be repeated. reconfigure() is the official Python 3.7+ API for this; errors='replace' degrades gracefully on legacy consoles instead of crashing.
Environment: Windows 11, Python 3.13, graphify 0.8.26, PowerShell.
Fixed in commit 31a608f, shipping in the next release.
Two-pronged fix:
sys.stdout.reconfigure(encoding='utf-8', errors='replace') — added at the very top of main() before any output. On Windows consoles with cp1252/cp1251 encoding, this switches the stream to UTF-8 and falls back to ? for any character that still can't render, so nothing crashes.
Symbol cleanup — replaced every → and — in print() calls across __main__.py, export.py, and prs.py with -> and -. Belt-and-suspenders: if reconfigure ever isn't available (e.g. PYTHONIOENCODING overrides, output redirected to a file opened in binary mode), the output is still safe ASCII.
Activity
[-]backup_if_protected silently fails on Windows due to → in print statement[/-][+]Success message with "→" crashes backup reporting on Windows[/+]fix Windows cp1252 crash, str.parent crash, mcp error message, god_no…
safishamsi commentedon May 23, 2026
Fixed in v8 — replaced non-ASCII
→with->in all print statements in__main__.py. Ships in next release.sub4biz commentedon May 30, 2026
The bug is back in 0.8.26, this time in
export.pyrather than__main__.py.The previous fix replaced
→in__main__.py, but missedexport.py, line 89:This
UnicodeEncodeErroris caught by the broadexcept Exceptionon line 91 - the same handler that catches real backup failures - so the backup is falsely reported as failed even thoughshutil.copy2already finished successfully.Fixing symbols file by file doesn't scale - any future
→,—,✓, or emoji in anyprint()call across any module will hit the same issue on Windows.Suggested permanent fix - two lines at the top of
main()in__main__.py:This covers all modules in one place and never needs to be repeated.
reconfigure()is the official Python 3.7+ API for this;errors='replace'degrades gracefully on legacy consoles instead of crashing.Environment: Windows 11, Python 3.13, graphify 0.8.26, PowerShell.
fix Windows Unicode crash on non-UTF-8 consoles (issue #992)
safishamsi commentedon May 30, 2026
Fixed in commit 31a608f, shipping in the next release.
Two-pronged fix:
sys.stdout.reconfigure(encoding='utf-8', errors='replace')— added at the very top ofmain()before any output. On Windows consoles with cp1252/cp1251 encoding, this switches the stream to UTF-8 and falls back to?for any character that still can't render, so nothing crashes.Symbol cleanup — replaced every
→and—inprint()calls across__main__.py,export.py, andprs.pywith->and-. Belt-and-suspenders: ifreconfigureever isn't available (e.g.PYTHONIOENCODINGoverrides, output redirected to a file opened in binary mode), the output is still safe ASCII.Full test suite passes (1483 passed, 0 failures).
safishamsi commentedon May 30, 2026
@sub4biz changes are committed, will bump the package version and push to PyPI shortly so you can pip install the fix.
fix Windows cp1252 crash, str.parent crash, mcp error message, god_no…
fix Windows Unicode crash on non-UTF-8 consoles (issue Graphify-Labs#992