Running into Errors creating a Python CSV file Concatenator script - Request Help

Words
166
Reading
1 min
Listen
Play
8y

Figured it would be good to get more eyes on this. I'll gladly open source it for others once I get it working. Going to post this on StackExchange later but figured I'd give this shot first.

Usage should be fairly easy. Run the script, it'll prompt for a path, enumerate all the csv filenames in the path, and then cycle through each (ignoring the headers - assumed they are identical) constructing the output file.


TabError: inconsistent use of tabs and spaces in indentation

Result contains a list of file names and path contains a path on my system.

The problem code snippet is as follows. I've ensured there are no stray spaces and in the block but no joy.

for r in result:
    with open(path+r,'r') as f:
        header  =  f.readline()
        for line in f:
            fout.write(line)

As you can see below, it works fine if I don't place the With statement in the For loop. Probably making a rookie mistake and hoping it's something a veteran Python coder will pick up on easily.

I was working based on this question on StackExchange.

Running into Errors creating a Python CSV file Concatenator script ... | Ecency