jash-kothari-forks / libtorrent

Automatically exported from code.google.com/p/libtorrent
Other
0 stars 0 forks source link

invalid bencoding on windows #479

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
These are my steps that will reproduce the problem:
1. download libtorrent-rasterbar
2. go to bindings\python folder
3. modify make_torrent.py to save the result into file
3. run make_torrent.py
My modified make_torrent is attached

The resulting .torrent file cannot be read by libtorrent and utorrent. The 
error said invalid bencoding. It can be displayed by 
http://i-tools.org/torrent/exec though. 

I am using Windows XP SP3, Python 2.7.5 and libtorrent-0.16.8.

The problem might lie in the implementation of bencode and generate functions 
in Windows.

Could anybody suggest a hint?

Original issue reported on code.google.com by umars...@gmail.com on 17 May 2013 at 8:37

Attachments:

GoogleCodeExporter commented 9 years ago
You need to pass in the 'b' option to open() in order to save the file as 
binary. If you don't do this, windows will helpfully turn all of your '\n' 
characters into '\r\n' when saved to the file, resulting in invalid bencoding.

Original comment by arvid.no...@gmail.com on 17 May 2013 at 3:42

GoogleCodeExporter commented 9 years ago
Thank you for your suggestion. It solved my problem.

I put 'b' option in read command but forget to put 'b' in write command. Silly 
mistake :(

Original comment by umars...@gmail.com on 20 May 2013 at 2:09

GoogleCodeExporter commented 9 years ago

Original comment by arvid.no...@gmail.com on 20 May 2013 at 3:02