Python Forum
How do I use tabs and spaces? (how to resolve error TabError: inconsistent)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I use tabs and spaces? (how to resolve error TabError: inconsistent)
#4
When you run the program you need to pass an argument. The program checks this, but in the wrong place. Your code should look like this:
if len(sys.argv) < 2:
    print "No input file name given!"
    exit()
bank = Bank(sys.argv[1])
bank.gencsvk()
Now if you forget to provide a filename you will get the informative message "No input file name given!" instead of an obscure error message about index out of range.

To use this program you will use a command like "python knab.py somefilename" where "somefilename" is the name of a file that appears to contain transactions.
Reply


Messages In This Thread
RE: How do I use tabs and spaces? (how to resolve error TabError: inconsistent) - by deanhystad - May-17-2021, 09:15 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with removing spaces and tabs from a string msqpython 14 4,247 Jan-21-2021, 10:48 PM
Last Post: deanhystad
  How Can I Resolve This Error JayJayOi 10 7,569 Jan-18-2018, 02:59 PM
Last Post: JayJayOi

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020