1

I'm editing django files in Eclipse Indigo with pydev. Suddenly in one file, eclipse has decided to start using four spaces instead of tabs. The file has a .py extension. It's fine in other files, it's just this one that it's having trouble with. The settings are correct for using tabs. I've tried closing and reopening the file, qutting and restarting eclipse, removing all the spaces and reloading the file, but still eclipse insists on using spaces, which is really irritating because eclipse then flags it as an error.

Anyone else experienced this before, and if so, how did you fix it?

TimD
  • 1,371
  • 3
  • 12
  • 20
  • 1
    There are two settings: one in General>Editor and one in Pydev>Editor. Do both say "use tabs, not spaces"? – inspectorG4dget Jul 14 '12 at 23:06
  • Haha, there was a setting in PyDev -> Editors to replace tabs with spaces. Turning it off fixed it. Not sure why it's only manifested itself in this one file though... – TimD Jul 14 '12 at 23:39

2 Answers2

2

This was originally a comment on the OP, but turned out to be the correct answer, so I'm reposting.

The setting to replace tabs with spaces exists in two places in eclipse:

  1. General > Editors > Text Editors
  2. Pydev > Editor

Both these settings need to be set correctly in order to solve this problem as they can override each other

inspectorG4dget
  • 110,290
  • 27
  • 149
  • 241
0

In my case I couldn't replace (retroactively) with Eclipse nor PyDev. They allow us to write 4 spaces "while typing", but not replace old files.

So, I used an external tool called Reindent

The only thing I don't like is that it creates backups of all the files and in 1.1 you don't have any flag to avoid it. This means that at the end of the execution, you have double source...

toscanelli
  • 1,202
  • 2
  • 17
  • 40