Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Using Databases in Python Meet Peewee Queries Are Your Friend

James Zwar
James Zwar
11,737 Points

Trying to solve a Python/VIM problem (I think)

I keep getting an indentation error when I try to run the code for this lesson. I'm confident it isn't the code because copying and pasting it into workspaces will run.

I'm using VIM (watched kenneth's workshop) - and I think it may be the source of the problem. I made some changes to the ~/.vimrc file to make indentation smaller and I think this threw things off a bit.

My question I suppose is - what is a good setup for python with vim to avoid indentation problems (or other common errors)?

1 Answer

William Li
William Li
Courses Plus Student 26,865 Points

I'm using vim with python-mode, I believe with this plugin installed, its default setting forces you to write PEP8-compliant Python code.

You may wanna adjust some default setting for python-mode, for example, I don't like the automatic code folding, so I added this line to my .vimrc to turn it off.

let g:pymode_folding = 0

Also, the rope plugin included with python-mode crashes my vim while triggering certain code completion, so I switched to jedi, which is a much nicer code completion engine. But rope and jedi have conflict issue, so you need to turn rope off if you decide to use jedi or some other code completion plugin.

let g:pymode_rope = 0

Hope it helps.