Commit 2663ced
authored
fix: escape Windows paths in STARTUP_CODE string formatting
When running on Windows systems, the STARTUP_CODE template's __file__ assignment could fail due to unescaped backslashes in the Windows path. This occurs when formatting the path string into STARTUP_CODE, as Windows paths (e.g., "C:\Users\...") contain backslashes that need proper escaping in Python strings.
The fix uses Path.as_posix() to convert Windows backslashes to forward slashes, which Python handles correctly across all operating systems. This ensures the path string is properly escaped when inserted into the STARTUP_CODE template.
Technical details:
- Uses existing pathlib.Path object's as_posix() method
- Converts "C:\path\to\file" to "C:/path/to/file"
- Maintains cross-platform compatibility
- Fixes string formatting issues without changing functionality1 parent 8915c48 commit 2663ced
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
0 commit comments