fix(watcher): use ASCII-only comments/log strings (IronPython 2.7 syntax error)
0.4.1 used em-dashes (--) in three log strings and one docstring line. IronPython 2.7 (CODESYS scripting host) rejects non-ASCII bytes in a source file unless an explicit encoding declaration (PEP 263) is present: Microsoft.Scripting.SyntaxErrorException: Non-ASCII character '\xe2' in file ...\watcher.py on line 225, but no encoding declared Replaced em-dashes with ASCII '--' and bumped WATCHER_VERSION to 0.4.2. File is now ASCII-clean throughout. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
93a105a644
commit
f1ea6e446f
1 changed files with 5 additions and 5 deletions
|
|
@ -25,7 +25,7 @@ IPC_BASE_DIR = r"{IPC_BASE_DIR}"
|
|||
COMMANDS_DIR = os.path.join(IPC_BASE_DIR, "commands")
|
||||
RESULTS_DIR = os.path.join(IPC_BASE_DIR, "results")
|
||||
POLL_INTERVAL = 50 # milliseconds
|
||||
WATCHER_VERSION = "0.4.1"
|
||||
WATCHER_VERSION = "0.4.2"
|
||||
|
||||
# --- Error capture file (written before anything else can fail) ---
|
||||
_ERROR_FILE = os.path.join(IPC_BASE_DIR, "watcher_error.txt")
|
||||
|
|
@ -222,13 +222,13 @@ try:
|
|||
|
||||
CODESYS injects KeyboardInterrupt into the script when the user
|
||||
clicks "Click here to CANCEL this operation" in the IDE. The
|
||||
watcher should keep running across that — only an explicit
|
||||
watcher should keep running across that -- only an explicit
|
||||
terminate.signal or process kill should stop it.
|
||||
"""
|
||||
try:
|
||||
se.system.delay(ms)
|
||||
except KeyboardInterrupt:
|
||||
_log("KeyboardInterrupt during system.delay() — ignored, watcher continues")
|
||||
_log("KeyboardInterrupt during system.delay() - ignored, watcher continues")
|
||||
|
||||
while True:
|
||||
try:
|
||||
|
|
@ -244,7 +244,7 @@ try:
|
|||
if cmd_files:
|
||||
process_command(cmd_files[0])
|
||||
except KeyboardInterrupt:
|
||||
_log("KeyboardInterrupt during loop iteration — ignored, watcher continues")
|
||||
_log("KeyboardInterrupt during loop iteration - ignored, watcher continues")
|
||||
except Exception as e:
|
||||
_log("Loop error: %s\n%s" % (e, traceback.format_exc()))
|
||||
|
||||
|
|
@ -257,7 +257,7 @@ except KeyboardInterrupt:
|
|||
# Last-resort: a Cancel that fires before the loop is even reached
|
||||
# (e.g. during scriptengine import or directory setup) should still
|
||||
# exit quietly without the CODESYS exception dialog.
|
||||
_write_error("KeyboardInterrupt outside main loop — exiting quietly")
|
||||
_write_error("KeyboardInterrupt outside main loop - exiting quietly")
|
||||
print("[WATCHER] Cancelled by user before main loop; exiting.")
|
||||
except Exception as _fatal:
|
||||
_write_error("FATAL: %s\n%s" % (_fatal, traceback.format_exc()))
|
||||
|
|
|
|||
Loading…
Reference in a new issue