teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

追記を入力しました。

2020/09/19 10:57

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -108,4 +108,45 @@
108
108
  result = subprocess.run(cmd, shell=True)
109
109
  msgList.insert(tk.END, result)
110
110
  ```
111
- def select_file():内の**f_path_list**(ファイルパス)をdef get_mediainfoで参照したいと思っていますが、ファイルを読み込んでもffproveが実行されず悩んでいます。
111
+ def select_file():内の**f_path_list**(ファイルパス)をdef get_mediainfoで参照したいと思っていますが、ファイルを読み込んでもffproveが実行されず悩んでいます。
112
+
113
+
114
+
115
+ **追記**
116
+ ```
117
+ import tkinter as tk
118
+ import tkinter.filedialog as tkfd
119
+ import subprocess
120
+
121
+ # グローバル変数
122
+ acv_path = ""
123
+ f_path_list = []
124
+
125
+ ### この下に関数を書く ###
126
+
127
+ def select_file():
128
+ global f_cont, f_path_list
129
+
130
+ f_conf = [('MOV file (*.mov)', '*mov'), ('AVI file (*.avi)', '*.avi'),('MP4 file (*.mp4)', '*.mp4')]
131
+ paths = tkfd.askopenfiles(filetypes=f_conf)
132
+ for f in paths:
133
+ f_path_list.append(f.name)
134
+ # Insert to Message List
135
+ msgList.insert(tk.END, f_path_list)
136
+ # Insert Input Path TextBox
137
+ inpFld.insert(tk.END, f_path_list)
138
+
139
+
140
+ def get_mediainfo():
141
+ # 変数を定義する
142
+ targetfile = f_path_list
143
+ # コマンドを定義して、変数を挿入する
144
+ cmd = 'ffprobe -i {}'.format(targetfile)
145
+ # コマンドを実行する
146
+ result = subprocess.run(cmd, shell=True)
147
+ msgList.insert(tk.END, result)
148
+
149
+ ```
150
+ 実行ボタンを作成し、情報取得を実行すると
151
+ CompletedProcess(args="ffprobe -i ['/Python/IMG_1138.MOV']", returncode=1)
152
+ というエラーが出ました。