From ac98e8a623014232f325a8bc2111319fdaef69c4 Mon Sep 17 00:00:00 2001 From: Pavel Minaev Date: Thu, 12 Mar 2020 19:05:58 -0700 Subject: [PATCH] Fix #69: "Couldn't spawn debuggee" with non-ASCII filename on Python 2.7 Prevent implicit filename conversion from bytes to unicode with incorrect encoding. --- src/debugpy/server/cli.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/debugpy/server/cli.py b/src/debugpy/server/cli.py index a035cbb5..87846650 100644 --- a/src/debugpy/server/cli.py +++ b/src/debugpy/server/cli.py @@ -190,7 +190,9 @@ def parse_argv(): except StopIteration: raise ValueError("missing target: " + TARGET) - switch = arg if arg.startswith("-") else "" + switch = compat.filename(arg) + if not switch.startswith("-"): + switch = "" for pattern, placeholder, action in switches: if re.match("^(" + pattern + ")$", switch): break