Hi, much thanks for the providing the script!
While running the script under Windows, i found that the generated jpgs open with errors. When opening the jpg with Photoshop, it pops up a dialog about the file may be truncated or incomplete, which is the case. The jpg file size is too small (most around 6 to 7KB). In the end, I found that in the code, open the file using binary mode fix the problem.
I changed open(src_filename, 'r')
to open(src_filename, 'rb')
and open(dst_filename, 'w')
to open(dst_filename, 'wb')
.
Another thing I noticed while running the script second time (because the first time I used the remove option and part of the files are replaced with bad jpgs, I replace those jpgs back with their correspond cngs), the script won't convert the cng. It appears that the code didn't detect the file extension because they are uppercase (eg. "NGM_1995_08_001_4.CNG").
I changed if ext == '.cng'
to if ext**.lower()** == '.cng'
.
(However I also wonder why the first time it works.)