when you call format_file.py, just leave off the extension.  If it's not written as it is above, then dots in the file name throw off latex -- the part of the filename that might have dots that comes beore the .pdf extension has to be in curly braces.