Skip to content

Missing encoding argument for pipe open #200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
aklein3 opened this issue Mar 21, 2025 · 0 comments
Open

Missing encoding argument for pipe open #200

aklein3 opened this issue Mar 21, 2025 · 0 comments

Comments

@aklein3
Copy link

aklein3 commented Mar 21, 2025

The call to open() to terminate MiniZinc on Windows omits the encoding argument. This triggers an EncodingWarning if warnings are enabled (-W default).

The fix is as follows:

--- a/src/minizinc/instance.py
+++ b/src/minizinc/instance.py
@@ -675,7 +675,8 @@ class Instance(Model):
                 # First, terminate the process
                 if sys.platform == "win32":
                     with open(
-                        f"\\\\.\\pipe\\minizinc-{proc.pid}", mode="w"
+                        f"\\\\.\\pipe\\minizinc-{proc.pid}", mode="w",
+                        encoding="utf8"
                     ) as named_pipe:
                         # Trigger MiniZinc termination
                         named_pipe.write("")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant