i wrote app in python 2.7 retrieves length of media files using moviepy. if run command line, works fine; after freezing code, when run console window closes immediately. i've tried cx_freeze, pyinstaller , py2exe, same results. there wrong code or issue moviepy? i'm testing on windows 10, used on windows 7 in end. here's code:
#!/usr/bin/python # -*- coding: utf-8 -*- # video-audio length retriever # # version: 0719a # # author: simon lachaƮne import codecs moviepy.editor import videofileclip, audiofileclip import os directories = [] def read_directories(): global directories directories_txt = raw_input("enter path , name of text file containing source directories: ") codecs.open(directories_txt, "r", encoding="utf8") source_dirs: directories = [line.rstrip() line in source_dirs] def write_text(report, text2save): open(report, "a") report: report.write(text2save) def check_duration(): directory in directories: root, dirs, files in os.walk(directory): os.chdir(root) fichier in files: try: video = videofileclip(fichier) m, s = divmod(video.duration, 60) h, m = divmod(m, 60) length = fichier + " ; " + "%02d:%02d:%02d\n" % (h, m, s) write_text(durations_report, length) print "processed file " + fichier except ioerror: pass except keyerror: try: audio = audiofileclip(fichier) m, s = divmod(audio.duration, 60) h, m = divmod(m, 60) length = fichier + " ; " + "%02d:%02d:%02d\n" % (h, m, s) write_text(durations_report, length) print "processed file " + fichier except ioerror: pass read_directories() durations_report = raw_input("enter path , name of report create: ") check_duration()
you can run frozen code command line view error message.
as far pyinstaller concerned, can't see hook in hooks folder moviepy , not bundled in frozen version. can add (or else might missing) hidden import: https://pythonhosted.org/pyinstaller/when-things-go-wrong.html?highlight=hidden#listing-hidden-imports
Comments
Post a Comment