Error code with if statement
Question: I just set up a new python script and when I run it I get the error code:

    
    
    File "conversion.py", line 17
        elif filetype == "Audio":
           ^
    

My code is:

    
    
    if filetype == "Document":
        path = raw_input("Please drag and drop the directory in which the file is stored into the terminal:")
        os.chdir(path[1:-2])
        filename = raw_input("Please enter the name of the file you would like to convert, including the file-type. e.g. test.txt, however please do make sure that the file-name does not have any spaces:")
        Fileextension = raw_input("What filetype would you like the program to convert your file to. E.g. .txt: ")
        from subprocess import check_call   
    subprocess.check_call(['unoconv', '-f', Fileextension, filename])
    
    elif filetype == "Audio":
        path = raw_input("Please drag and drop the directory in which the file is stored into the terminal:")
        os.chdir(path[1:-2])
        filename = raw_input("Please enter the name of the file you would like to convert, including the file-type. e.g. test.txt, however please do make sure that the file-name does not have any spaces:")
        Fileextension = raw_input("What filetype would you like the program to convert your file to. E.g. .mp3: ")
        body, ext = os.path.splitext("filename")
        check_call(["ffmpeg" ,"-i", filename, body Fileextension])
    
    elif filetype == "Video":
        path = raw_input("Please drag and drop the directory in which the file is stored into the terminal:")
        os.chdir(path[1:-2])
        filename = raw_input("Please enter the name of the file you would like to convert, including the file-type. e.g. test.txt, however please do make sure that the file-name does not have any spaces:")
        Fileextension = raw_input("What filetype would you like the program to convert your file to. E.g. .mp4: ")
        body, ext = os.path.splitext("filename")
        from subprocess import check_call   
        check_call(["ffmpeg" ,"-i", filename, body Fileextension])
    
    elif filetype == "Image":
        path = raw_input("Please drag and drop the directory in which the file is stored into the terminal:")
        os.chdir(path[1:-2])
        filename = raw_input("Please enter the name of the file you would like to convert, including the file-type. e.g. test.txt, however please do make sure that the file-name does not have any spaces:")
        Fileextension = raw_input("What filetype would you like the program to convert your file to. E.g. .Jpeg: ")
        body, ext = os.path.splitext("filename")
        from subprocess import check_call   
        check_call(["ffmpeg" ,"-i", filename, body Fileextension])
    

Does anybody have any idea as to what the error here is. Any solution would be
very much appreciated. I have been trying to solve it for an hour now and I
still have no idea as to why it happens.


Answer: You are mixing tabs and spaces, and as a result your
`subprocess.check_call(['unoconv', '-f', Fileextension, filename])` line is
not indented far enough. Python expands tabs to match every _8 spaces_ , but
you appear to have configured your editor to indent to 4 spaces for a tab
instead:

    
    
    >>> lines = '''\
    ...             from subprocess import check_call       
    ...     subprocess.check_call(['unoconv', '-f', Fileextension, filename])
    ... '''
    >>> lines.splitlines()[1]
    "    subprocess.check_call(['unoconv', '-f', Fileextension, filename])"
    >>> lines.splitlines()[0]
    '    \tfrom subprocess import check_call\t'
    

Note the `\t` character on the `import` line, while the next line (printed
first above to call out the tab better). All your indented lines use tabs,
except the `subprocess.call()` line.

Configure your editor to expand tabs to spaces instead; Python works best when
you avoid tabs for indentation. The [Python style
guide](https://www.python.org/dev/peps/pep-0008/#tabs-or-spaces) strongly
recommends you use spaces over tabs:

> Spaces are the preferred indentation method.
>
> Tabs should be used solely to remain consistent with code that is already
> indented with tabs.

