'When copying from Github the indentation is not preserved

I was trying to copy from GitHub the following file: https://github.com/vineodd/PIMSim/blob/master/GEM5Simulation/gem5/configs/common/MemConfig.py

I have tried using git clone, downloading directly from the website and also copying and pasting. I have done this in four different text editors: sublime text, atom, textWrangler and Spyder. In Spyder it gives me the following message:

Contains mixed end-of-line characters.

Every time, when I open the file the indentation is wrong in a lot of places, what is a problem because it is a Python file. You can see it for example in the line 280. In GitHub all appears to be fine. Can I do something to fix this? Has this happened to anyone before? Any help would be appreciated. Thanks in advance!



Solution 1:[1]

I have already figured it out what was happening here. The file was combining spaces and tabs for indentation. GitHub displays tabs as 8 columns (spaces), but in the text editors it was equivalent to 4 columns. So to fix it I opened a new file where I just wrote a tab. I copied it and used it to replace all tabs for 8 columns.

Solution 2:[2]

If you're using intellij/Android studio, you can 'Paste as Plain Text'

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 shaymin shaymin
Solution 2 Kng1230