X Tutup
Skip to content

Update breakpoint module to use python find_spec instead of find_module #1139

@Toure

Description

@Toure

Python find_module function has been deprecated as of py3.4 and find_spec is the replacement, it contains the same interface and will fix the error message received when opening a python file in vim-python-mode:

diff --git a/autoload/pymode/breakpoint.vim b/autoload/pymode/breakpoint.vim
index c3189aa..e62c041 100644
--- a/autoload/pymode/breakpoint.vim
+++ b/autoload/pymode/breakpoint.vim
@@ -15,11 +15,11 @@ fun! pymode#breakpoint#init() "{{{
 
         PymodePython << EOF
 
-from imp import find_module
+from importlib.util import find_spec
 
 for module in ('wdb', 'pudb', 'ipdb'):
     try:
-        find_module(module)
+        find_spec(module)
         vim.command('let g:pymode_breakpoint_cmd = "import %s; %s.set_trace()  # XXX BREAKPOINT"' % (module, module))
         break
     except ImportError:

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    X Tutup