Domanda

Hello I have a an error that I have attempted with failure to manage

the code that is having trouble is this function

def get_peer_info_from_magnet( magnet, ports, opt ):
    ses = lt.session()
    ses.listen_on( ports[0], ports[1] )

    ses.set_download_rate_limit( opt.download_rate  * 1024 )
    ses.set_upload_rate_limit( opt.upload_rate * 1024 )
    h = lt.add_magnet_uri( ses, magnet, {
          'save_path': opt.save_path,
          'storage_mode': lt.storage_mode_t.storage_mode_sparse,
          'seed_mode': True,
          #'tracker_url': opt.tracker_url,
          'paused': False
         } )

which is yielding the error

Traceback (most recent call last):
  File "/usr/lib/python2.6/multiprocessing/process.py", line 232, in _bootstrap
    self.run()
  File "magnet_info.py", line 45, in run
    self._fetchData( magnet )
  File "magnet_info.py", line 54, in _fetchData
    pi = get_peer_info_from_magnet( magnet, ports, self.options )
  File "magnet_info.py", line 140, in get_peer_info_from_magnet
    'paused': False
KeyError: 'auto_managed'

I looked up this error in the libtorrent documentation and found a method set_upload_mode() which looked promising but I either am not using it correctly or it is not the correct path to go down.

Thank you for your help

È stato utile?

Soluzione

It appears that libtorrent is expecting you to pass in an auto_managed parameter. Based on the error, this may be due to the 'paused': False parameter you are passing in; you may need to pass 'auto_managed': True along with this, though I haven't used libtorrent myself so I'm not sure. You might also want to try removing the 'paused': True, and see if that works.

After taking a closer look, it looks like add_magnet_uri() is deprecated in libtorrent. Instead, you are simply supposed to call add_torrent() and pass in a url parameter with the magnet URL. You might want to give that a try.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top