diff --git a/bin/mkpodcastplaylist b/bin/mkpodcastplaylist index db14a92..3737b04 100755 --- a/bin/mkpodcastplaylist +++ b/bin/mkpodcastplaylist @@ -5,6 +5,7 @@ largest file/directory. It searches directories, getting their size and lists the first file in the largest direcotry. """ +import errno import os import sys @@ -94,11 +95,15 @@ def main(): headfile = directories[0].get_head_file() #headfile = headfile.replace('podcasts/', 'podcast/', 1) #print headfile - sys.stdout.write("%s\n" % headfile) + try: + sys.stdout.write("%s\n" % headfile) + except IOError as e: + if e.errno == errno.EPIPE: + return + raise e directories[0].remove_head_file() if directories[0].num_files() == 0: directories = directories[1:] if __name__ == "__main__": main() -