Indentation problem with python3 and vim

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
0
down vote

favorite












A sample of my python file is



def __init__(self, csvFile, chunksize=10000):
self.newName = csvFile[:-4]
import ipdb; ipdb.set_trace()
self.csvFile=csvFile
self.chunksize=int(chunksize)
self.headers_without_timestamp = header_without_timestamp

self.total_rows = 0
self.username=username
self.password=password
self.dbname="data"


and it is well written.



I have the little error, but I can't fix it. When I ran the command python3 Final_Fast_Version_Waqar.py ~/home/Data/DCIX_OB.csv 1000 7, I got



 File "Final_Fast_Version_Waqar.py", line 37
import ipdb; ipdb.set_trace()
^
TabError: inconsistent use of tabs and spaces in indentation


It is a problem related to the vim editor I guess because I set up an Ubuntu server and installed vim very recently. How can I fix the indentation error?







share|improve this question




















  • Were you using Vim to write the script?
    – ubashu
    May 16 at 2:44










  • Yes, write this script with Vim.
    – Jeremie
    May 16 at 2:44










  • The error says it all actually, you're mixing tabs and spaces. Double check that you only use one of the two (4 spaces is preferred) for indentation.
    – Timo
    May 16 at 7:49














up vote
0
down vote

favorite












A sample of my python file is



def __init__(self, csvFile, chunksize=10000):
self.newName = csvFile[:-4]
import ipdb; ipdb.set_trace()
self.csvFile=csvFile
self.chunksize=int(chunksize)
self.headers_without_timestamp = header_without_timestamp

self.total_rows = 0
self.username=username
self.password=password
self.dbname="data"


and it is well written.



I have the little error, but I can't fix it. When I ran the command python3 Final_Fast_Version_Waqar.py ~/home/Data/DCIX_OB.csv 1000 7, I got



 File "Final_Fast_Version_Waqar.py", line 37
import ipdb; ipdb.set_trace()
^
TabError: inconsistent use of tabs and spaces in indentation


It is a problem related to the vim editor I guess because I set up an Ubuntu server and installed vim very recently. How can I fix the indentation error?







share|improve this question




















  • Were you using Vim to write the script?
    – ubashu
    May 16 at 2:44










  • Yes, write this script with Vim.
    – Jeremie
    May 16 at 2:44










  • The error says it all actually, you're mixing tabs and spaces. Double check that you only use one of the two (4 spaces is preferred) for indentation.
    – Timo
    May 16 at 7:49












up vote
0
down vote

favorite









up vote
0
down vote

favorite











A sample of my python file is



def __init__(self, csvFile, chunksize=10000):
self.newName = csvFile[:-4]
import ipdb; ipdb.set_trace()
self.csvFile=csvFile
self.chunksize=int(chunksize)
self.headers_without_timestamp = header_without_timestamp

self.total_rows = 0
self.username=username
self.password=password
self.dbname="data"


and it is well written.



I have the little error, but I can't fix it. When I ran the command python3 Final_Fast_Version_Waqar.py ~/home/Data/DCIX_OB.csv 1000 7, I got



 File "Final_Fast_Version_Waqar.py", line 37
import ipdb; ipdb.set_trace()
^
TabError: inconsistent use of tabs and spaces in indentation


It is a problem related to the vim editor I guess because I set up an Ubuntu server and installed vim very recently. How can I fix the indentation error?







share|improve this question












A sample of my python file is



def __init__(self, csvFile, chunksize=10000):
self.newName = csvFile[:-4]
import ipdb; ipdb.set_trace()
self.csvFile=csvFile
self.chunksize=int(chunksize)
self.headers_without_timestamp = header_without_timestamp

self.total_rows = 0
self.username=username
self.password=password
self.dbname="data"


and it is well written.



I have the little error, but I can't fix it. When I ran the command python3 Final_Fast_Version_Waqar.py ~/home/Data/DCIX_OB.csv 1000 7, I got



 File "Final_Fast_Version_Waqar.py", line 37
import ipdb; ipdb.set_trace()
^
TabError: inconsistent use of tabs and spaces in indentation


It is a problem related to the vim editor I guess because I set up an Ubuntu server and installed vim very recently. How can I fix the indentation error?









share|improve this question











share|improve this question




share|improve this question










asked May 16 at 2:23









Jeremie

33




33











  • Were you using Vim to write the script?
    – ubashu
    May 16 at 2:44










  • Yes, write this script with Vim.
    – Jeremie
    May 16 at 2:44










  • The error says it all actually, you're mixing tabs and spaces. Double check that you only use one of the two (4 spaces is preferred) for indentation.
    – Timo
    May 16 at 7:49
















  • Were you using Vim to write the script?
    – ubashu
    May 16 at 2:44










  • Yes, write this script with Vim.
    – Jeremie
    May 16 at 2:44










  • The error says it all actually, you're mixing tabs and spaces. Double check that you only use one of the two (4 spaces is preferred) for indentation.
    – Timo
    May 16 at 7:49















Were you using Vim to write the script?
– ubashu
May 16 at 2:44




Were you using Vim to write the script?
– ubashu
May 16 at 2:44












Yes, write this script with Vim.
– Jeremie
May 16 at 2:44




Yes, write this script with Vim.
– Jeremie
May 16 at 2:44












The error says it all actually, you're mixing tabs and spaces. Double check that you only use one of the two (4 spaces is preferred) for indentation.
– Timo
May 16 at 7:49




The error says it all actually, you're mixing tabs and spaces. Double check that you only use one of the two (4 spaces is preferred) for indentation.
– Timo
May 16 at 7:49















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1036767%2findentation-problem-with-python3-and-vim%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1036767%2findentation-problem-with-python3-and-vim%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

pylint3 and pip3 broken

Missing snmpget and snmpwalk

How to enroll fingerprints to Ubuntu 17.10 with VFS491