diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
index 39f349391898383dc8a9298faac1bf33146fbff6_bWVyY3VyaWFsL2Rpc3BhdGNoLnB5..82131be5258e6ac4076a86829b256891c659b870_bWVyY3VyaWFsL2Rpc3BhdGNoLnB5 100644
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -413,7 +413,7 @@
                     # debugging has been requested
                     with demandimport.deactivated():
                         try:
-                            debugmod = __import__(debugger)
+                            debugmod = __import__(pycompat.sysstr(debugger))
                         except ImportError:
                             pass  # Leave debugmod = pdb