You shouldn't declare that something is done until it's done, especially if there's a chance that you might not do it at all. Also consider using curses for clarity and generality. The Esc[2J VT100 escape code deserves a comment. I consider that to be an improvement.) Copying (This isn't exactly equivalent to your original code, in that it also treats # as a comment even if it is preceded by whitespace. T not in is superfluous, since if t performs the same check. Print("No m3u file given", file=sys.stderr) ![]() If you want to catch Inde圎rror instead of checking for the length of sys.argv, then I suggest that you do so consistently for both arguments: from _future_ import print_function Even if you os.path.exists() finds a directory, there is a slim chance that it might get deleted in a race condition. ![]() os.makedirs(dest) will perform that check anyway.Existence doesn't actually guarantee that it is a directory rather than a regular file.Fatal errors should be reported on sys.stderr and cause a non-zero exit status.ĭon't check for os.path.exists(dest), because:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |