[Bug 232033] Re: bencode fails its own test

2008-05-19 Thread j^
** Attachment added: bencode.patch http://launchpadlibrarian.net/14609840/bencode.patch -- bencode fails its own test https://bugs.launchpad.net/bugs/232033 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing

[Bug 232033] Re: bencode fails its own test

2008-05-19 Thread Cameron Dale
bencoding specifically requires that dictionary keys be strings. See, for example: http://en.wikipedia.org/wiki/Bencode where it says All keys must be byte strings. ** Changed in: bittornado (Ubuntu) Status: New = Invalid -- bencode fails its own test

[Bug 232033] Re: bencode fails its own test

2008-05-19 Thread j^
but python dicts can have ints, as they have in the test function. thats why the encoding function has to cast it to string. which the patch does -- bencode fails its own test https://bugs.launchpad.net/bugs/232033 You received this bug notification because you are a member of Ubuntu Bugs, which

[Bug 232033] Re: bencode fails its own test

2008-05-19 Thread j^
looking a bit more at the code, the problem is in the test not in the cast. i ran into this while trying to get LaunchMany to save its torrent state, which fails here. -- bencode fails its own test https://bugs.launchpad.net/bugs/232033 You received this bug notification because you are a

Re: [Bug 232033] Re: bencode fails its own test

2008-05-19 Thread Cameron Dale
Python dicts can have almost anything (hashable) as a key, but bencoding requires a string. Your patch won't work because on bdecoding there is no way to tell that the key should have been an int, so it will not match the bencoded dict. The test I think you are referring to: try:

Re: [Bug 232033] Re: bencode fails its own test

2008-05-19 Thread Cameron Dale
On 5/19/08, j^ [EMAIL PROTECTED] wrote: looking a bit more at the code, the problem is in the test not in the cast. i ran into this while trying to get LaunchMany to save its torrent state, which fails here. Your code should never call the test_bencode function, but I guess you mean that it

[Bug 232033] Re: bencode fails its own test

2008-05-19 Thread Cameron Dale
By the way, you may want to look at the code for DebTorrent, which is based on BitTornado and also saves the state on shutdown and loads it on startup. This is controlled by the new pickle and unpickle functions at the bottom of the launchmanycore.py file, which you can brwose here:

[Bug 232033] Re: bencode fails its own test

2008-05-19 Thread j^
thanks, will check debtorrent out, looks interesting most of my problems came from an outdated BitTornado copy that was added to the python path. was looking in the wrong place... -- bencode fails its own test https://bugs.launchpad.net/bugs/232033 You received this bug notification because you