Issue
I'm trying to create a graphical program to deal with packages easily for end-users. However, I'm facing a problem in retrieving the package's description beside some other information.
I've seen the python-apt API here and i understood that i have to deal with the apt.package.Version()
class.
But when i tried to use it, all what i got is some errors like:
Traceback (most recent call last):
File "./myprogram", line 6, in <module>
print package.description
File "/usr/lib/python2.7/dist-packages/apt/package.py", line 374, in description
dsc = self._translated_records.long_desc
File "/usr/lib/python2.7/dist-packages/apt/package.py", line 315, in _translated_records
desc_iter = self._cand.translated_description
AttributeError: 'list' object has no attribute 'translated_description'
So, is there any body who can create a running example for the apt.package.Version() class please?
Thanks!
Solution
The versions
method gives you the list of all available versions. You then have to select one specific version to print the description. For example, for the vim package
import apt
cache = apt.Cache()
pkg = cache['vim']
versions = pkg.versions
print versions[0].description
Answered By - Ortomala Lokni