borzunov / bit-torrent

📁 🌎 BitTorrent client built with Python + asyncio
MIT License
155 stars 28 forks source link

Errors while trying to download #11

Closed zee9999 closed 2 years ago

zee9999 commented 2 years ago

I ran the following command python3 torrent_cli.py add ~/Torrents/debian-8.3.0-i386-netinst.iso.torrent -d ~/Downloads But got this error: File "torrent_cli.py", line 203, in <module> sys.exit(main()) File "torrent_cli.py", line 197, in main arguments.func(arguments) File "torrent_cli.py", line 147, in run_in_event_loop loop.run_until_complete(coro_function(args)) File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete return future.result() File "torrent_cli.py", line 77, in add_handler torrents = [TorrentInfo.from_file(filename, download_dir=args.download_dir) for filename in args.filenames] File "torrent_cli.py", line 77, in <listcomp> torrents = [TorrentInfo.from_file(filename, download_dir=args.download_dir) for filename in args.filenames] File "/home/zeyad/Downloads/bit-torrent-master/torrent_client/models.py", line 503, in from_file dictionary = cast(OrderedDict, bencodepy.decode_from_file(filename)) AttributeError: module 'bencodepy' has no attribute 'decode_from_file'

borzunov commented 2 years ago

Hi @zee9999!

It seems like you don't have properly installed dependencies. Could you please run pip install -r requirements.txt and try again?

Also, I've just committed a small fix resolving PyPI conflicts that may help with installing them.

If the problem persists, could you please try importing bencodepy and getting this method in the interactive console? In my case, this method does exist:

$ python3
Python 3.9.7 (default, Sep  3 2021, 12:45:31) 
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import bencodepy
>>> bencodepy.decode_from_file
<function decode_from_file at 0x10bbe9b80>
zee9999 commented 2 years ago

Yup this worked, My bad Thanks so much