1. Erik Svensson
  2. transmissionrpc
Issue #55 resolved

fields item list doesn't exist

Brian Hechinger
created an issue

In the documentation page: http://pythonhosted.org/transmissionrpc/

There is this example:

>>> for key, value in torrent.fields.iteritems():
...     print(key, value)
('comment', 'Ubuntu CD releases.ubuntu.com')

However, it gives the following error:

>>> for key, value in torrent.fields.iteritems():
...     print(key, value)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "transmissionrpc/torrent.py", line 92, in __getattr__
    raise AttributeError('No attribute %s' % name)
AttributeError: No attribute fields

I've tried this in 0.8-1 (what is in the Mint 15 repo), 0.10 out of the easy_install repo and the latest out of the development repo.

All three versions exhibit the same condition.

My question is twofold.

Is this something that needs to be fix or is there a different way to do this and the documentation is just incorrect?

Comments (5)

  1. Erik Svensson repo owner

    The documentation is incorrect. I'll update the documentation. You should use the fields explicitly. For example

    >>> torrent = client.get_torrent(1)
    >>> torrent.name

    It is possible to introspect using Torrent._fields, but this is not recommended for production use.

  2. Log in to comment