tags:

views:

163

answers:

2

I'm trying to use pydiction to autocomplete Python/Django statements in VIM Editor.

When I try to add django modules to complete-dic using this:

python pydiction.py /usr/lib/pymodules/python2.6/django

or:

python pydiction.py /usr/lib/pymodules/python2.6/django/__init__.py

I receive this error:

Couldn't import: (...). Import by filename is not supported.

Thanks!

Pydiction: http://www.vim.org/scripts/script.php?script_id=850

A: 

By glancing at the pydiction docs (I'm not a pydiction user) it appears that you are misusing the pydiction.py script.

You are not supposed to provide a filename for import. You are supposed to provide a module name on which to base the dictionary creation. The module must already be in your pythonpath.

So, with django in your pythonpath, you would do:

python pydiction.py django

celopes
A: 

For some reason doing

python pydiction.py django

will not add the submodules of django

What I had to do was:

export DJANGO_SETTINGS_MODULE=settings
export PYTHONPATH=/path/to/parent/of/settings

And then I had to add each submodule of django individually

python pydiction.py django.bin
python pydiction.py django.conf
python pydiction.py django.contrib

And so on. Tedious but it works

oivvio