【问题标题】:BTL.BTFailure: not a valid bencoded stringBTL.BTFailure:不是有效的编码字符串
【发布时间】:2015-09-26 23:21:53
【问题描述】:

我一直在尝试使用此 python 代码 http://blog.abhijeetr.com/2011/10/add-trackers-to-torrent-files-in-linux.html 自动将某些公共跟踪器添加到 torrent 文件中。

安装 BitTorrent-bencode 5.0.8.1 并将“bencode.py”文件和“BTL.py”复制到包含我的“add_tracker.py”、“trackers.txt”和“Spaceman.2009”的文件夹中。 Xvid-VODO.mp4.torrent”,我得到错误:

Microsoft Windows [Version 10.0.10240]
(c) 2015 Microsoft Corporation. All rights reserved.

C:\Users\a>cd C:\Users\a\Documents\python\lol

C:\Users\a\Documents\python\lol>add_tracker.py trackers.txt Spaceman.2009.Xvid-VODO.mp4.torrent
Traceback (most recent call last):
File "C:\Users\a\Documents\python\lol\add_tracker.py", line 22, in <module>
decoded_data = bencode.bdecode(torrent_file.read())
File "C:\Users\a\Documents\python\lol\bencode.py", line 68, in bdecode
raise BTFailure("not a valid bencoded string")
BTL.BTFailure: not a valid bencoded string

C:\Users\a\Documents\python\lol>

另外,我还尝试了旧的“bencode.py”版本,最初的帖子位于:github /shadyabhi/Bencode-Torrent-Editor

它们都挂在同一点上。

到目前为止,我的搜索表明这是由于损坏的 torrent 造成的,以证明我已经尝试了成群的不同的 torrent,都产生了相同的结果,同时使用 torrenteditor.com 评估它们。

除此之外,我不能完全/完全不能剖析 bencode.py 和 add_tracker.py 的实际代码,正如这里不同问题中所解释的,关于使用相同的脚本,因为我缺乏python经验。

如果有人能告诉我为什么会出现这个问题,以及我可以/应该做些什么来解决它,我将不胜感激:)

对于可能不一致的布局,我很抱歉。

【问题讨论】:

  • 你有那个 .torrent 文件的链接吗?

标签: python-2.7 bittorrent tracker


【解决方案1】:

是的,它是http://vodo.net/download/torrent/446,并已通过三种方式验证:

  • 在种子程序中测试过
  • 阅读 torrenteditor.com
  • 在创建者编写的原始代码中验证并使用无此错误*

*这里有完整的讨论:http://blog.abhijeetr.com/2011/10/add-trackers-to-torrent-files-in-linux.html

顺便说一句,我已经通过其他方式达到了我的目标,但我没有解决这个错误。为了我的理解,也许其他人的理解,我仍然很好奇是否有人能指出错误发生的原因。特别是因为我一字不差地复制了给定的代码,并遵循了程序(据我所知)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-09-05
    • 2014-02-19
    • 2016-10-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-23
    相关资源
    最近更新 更多