I just tried <C-c>ra for the first time and I get the following error:
E492: Not an editor command: PymodeRopeAutoImport
Thing is, other python-mode commands do seem to be available, as evidenced by the tab completion from wildmenu:
PymodeDoc PymodeLintToggle PymodeRopeNewProject PymodeRopeRenameModule PymodeTroubleshooting
PymodeLint PymodePython PymodeRopeRedo PymodeRopeUndo PymodeVersion
PymodeLintAuto PymodeRopeModuleToPackage PymodeRopeRegenerate PymodeRun PymodeVirtualenv
:Pymode
Am I missing a bit of configuration or is this an issue with python-mode? I haven't customized python-mode, I just have the plugin declaration in my .vimrc:
Plug 'python-mode/python-mode'
@pieterdd,
I made it work by enabling the rope auto import mode:
let g:pymode_rope_autoimport=1
Hmm. When I try that, this sometimes happens on my computer:
[Pymode] Init Rope project: /Users/pdedecker/Desktop/pythontest
Error detected while processing function pymode#rope#autoimport:
line 1:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/pdedecker/.vim/plugged/python-mode/pymode/rope.py", line 335, in autoimport
_insert_import(word, modules[0], ctx)
File "/Users/pdedecker/.vim/plugged/python-mode/pymode/rope.py", line 899, in _insert_import
module_imports.add_import(new_import)
File "/Users/pdedecker/.vim/plugged/python-mode/pymode/libs/rope/refactor/importutils/module_imports.py", line 120, in add_import
if import_statement.accept(visitor):
File "/Users/pdedecker/.vim/plugged/python-mode/pymode/libs/rope/refactor/importutils/importinfo.py", line 56, in accept
return visitor.dispatch(self)
File "/Users/pdedecker/.vim/plugged/python-mode/pymode/libs/rope/refactor/importutils/actions.py", line 143, in dispatch
if ImportInfoVisitor.dispatch(self, import_):
File "/Users/pdedecker/.vim/plugged/python-mode/pymode/libs/rope/refactor/importutils/actions.py", line 13, in dispatch
return method(import_, import_.import_info)
File "/Users/pdedecker/.vim/plugged/python-mode/pymode/libs/rope/refactor/importutils/actions.py", line 177, in visitFromImport
if self.project.prefs.get("split_imports"):
AttributeError: 'PyCore' object has no attribute 'prefs'
@pieterdd same here
Error detected while processing function pymode#rope#autoimport:
line 1:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/soulomoon/.vim/plugged/python-mode/pymode/rope.py", line 335, in autoimport
_insert_import(word, modules[0], ctx)
File "/Users/soulomoon/.vim/plugged/python-mode/pymode/rope.py", line 901, in _insert_import
ctx.resource, module_imports.get_changed_source())
File "/Users/soulomoon/.vim/plugged/python-mode/pymode/libs/rope/refactor/importutils/module_imports.py", line 54, in get_changed_source
if (not self.project.prefs.get("pull_imports_to_top") and
AttributeError: 'PyCore' object has no attribute 'prefs'
It would be nice to add this configuration line let g:pymode_rope_autoimport=1 to the pymode.txt file.
Most helpful comment
@pieterdd same here