python - 为什么我在 Tkinter 中收到“执行格式错误”消息
问题描述
我只想在 Raspberry PI 中运行来自 Tkinter 的 MP4 视频。如果我只是浏览到它所在的目录并单击它,则视频运行没有任何问题。它使用 VLC 播放视频。但是当我运行 Tkinter 程序并找到视频文件并运行它时,它给了我错误消息。
sh: 1: /home/Documents/Bobby/Pictures/myvideo.mp4: "Exec format error"
这是我的代码;
import tkinter as tk
# use ffmplay to play the videos with tkinter
import tkinter.ttk as ttk
import os
root = tk.Tk()
lb = tk.Listbox(root)
lb.pack()
def ffplay(event):
if lb.curselection():
file = lb.curselection()[0]
os.system("/home/pi/Documents/Bobby/Pictures/myvideo.mp4")
for file in os.listdir('/home/pi/Documents/Bobby/Pictures/'):
if file.endswith(".mp4"):
lb.insert(0, file)Exec format errorExec format error
bstart = ttk.Button(root, text="Start movie")
bstart.pack()
bstart.bind("<ButtonPress-1>", ffplay)
root.mainloop()
解决方案
推荐阅读
- python - 我没有得到输出或错误只是处理很长时间
- java - 如何从 BASE64 转换为 ZPL 代码(斑马打印)?
- docker - 有什么好的建议可以实现拒绝主机进入容器的目标吗?
- python - 如何在 Dash Web 应用程序中使用“dash.properties.Synced”?| Python
- json - SwiftUI 从 api.city.bik 获取 JSON API 数据
- javascript - 如何从 Azure Maps Route 计算遍历的状态
- python - 将多变量函数应用于 DataFrame 的列
- typescript - 是否可以纯粹使用 TypeScript 为对象创建对象键路径字符串自动完成功能?
- python - 对任何文件的蛮力数字攻击
- vps - 我可以用 Rclone 做一个文件共享网站吗