You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Telegram图片元数据机器人报FileNotFoundError的解决求助

解决Telegram图片元数据机器人的FileNotFoundError问题
  • 检查exiftool调用路径
    Windows下即使程序和脚本同目录,直接调用exiftool可能因环境变量问题找不到文件。修改脚本中调用exiftool的代码,使用相对路径.\exiftool.exe或完整绝对路径(比如C:\xxx\telegram-bot\exiftool.exe)。例如:

    # 原代码可能是
    subprocess.run(["exiftool", "-all=", "temp.jpg"])
    # 修改为
    subprocess.run([".\\exiftool.exe", "-all=", "temp.jpg"])
    
  • 确认temp.jpg的路径正确性
    脚本处理temp.jpg时,可能因当前工作目录不符导致找不到文件。在脚本中添加代码打印当前工作目录,验证是否在telegram-bot目录下:

    import os
    print(os.getcwd())
    

    如果路径不对,使用脚本所在目录的绝对路径来定位temp.jpg:

    temp_path = os.path.join(os.path.dirname(__file__), "temp.jpg")
    
  • 核对exiftool文件名
    确保下载的exiftool可执行文件名为exiftool.exe,而非exiftool(-k).exe这类带后缀的变体,避免文件名不匹配导致调用失败。

  • 验证exiftool独立运行能力
    打开终端,切换到telegram-bot目录,直接执行exiftool.exe。如果无法输出帮助信息,说明exiftool文件损坏或版本不对,重新下载适配Windows的exiftool可执行版本。

内容的提问来源于stack exchange,提问作者WhyIsThere A Cat On My Lettuce

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.24 22:35:55