Rarfile Python模块错误:Rarfile.rarcannotexec:找不到工作工具

发布于 2025-02-06 09:56:09 字数 632 浏览 0 评论 0原文

我想用rarfile python模块提取rar:

import rarfile

rar_path = r'C:\...\Test.rar'
rar_password = '123'


# rarfile.UNRAR_TOOL = r'path to what .exe? I cant find it, is this line necessary?'
rar = rarfile.RarFile(rar_path)
rar.extractall(pwd=rar_password)
rar.close()

我会得到这个错误:

rarfile.RarCannotExec: Cannot find working tool

我已经做了Google所说的:我安装了unrar,将其正确添加到路径并重新启动了我的IDE,

我还将winrar添加到路径,以防万一

我想我想该错误这意味着这是在搜索该统计工具,所以我想我需要做:

rarfile.UNRAR_TOOL = r'some path to the unrar exe tool'

但是Exe是什么?我找不到有关“ unrar_tool”的任何文档,

谢谢!

I want to extract a RAR with rarfile python module:

import rarfile

rar_path = r'C:\...\Test.rar'
rar_password = '123'


# rarfile.UNRAR_TOOL = r'path to what .exe? I cant find it, is this line necessary?'
rar = rarfile.RarFile(rar_path)
rar.extractall(pwd=rar_password)
rar.close()

I get this error:

rarfile.RarCannotExec: Cannot find working tool

I already did what google says: I installed unrar, added it to PATH correctly and restarted my IDE

I also added WinRar to PATH just in case

I suppose that the error means that is searching for that unrar tool, so I guess I need to do:

rarfile.UNRAR_TOOL = r'some path to the unrar exe tool'

but what exe? I cant find any documentation for the "UNRAR_TOOL"

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文