[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: more python rpm questions



On Sun, 13 Jan 2002, seth vidal wrote:

> so I am doing this:
> 
> import os, sys, rpm
> 
> 
> def readHeader(rpmfn):
>   import os,rpm
> 
>   fd = open(rpmfn, "r")
>   h = rpm.headerLoad(fd.read())
>   fd.close()
>   return h
> 
> 
> header = readHeader(sys.argv[1])
> header[rpm.RPMTAG_DESCRIPTION] = "none"
> 
> print header[rpm.RPMTAG_DESCRIPTION]
> 
> the idea is that I want to truncate description to the word none (or
> hell a null or anything - but just not the whole big description)
> 
> when I run this I'm getting this error:
> 
> Traceback (innermost last):
>   File "./clean_header.py", line 18, in ?
>     header[rpm.RPMTAG_DESCRIPTION] = "none"
> TypeError: object does not support item assignment
> 
> 
> is there any way to set a value inside the rpm header?
> what am I missing?

With the way the code is currently, you just cann't do that.
Theoretically its possible to modify the module so that this can be done
(or at least a function could be created to do it), but I've not done
much with the C library for rpm, so I'm not sure how hard it would be to
change that information in rpm's internal structures.


Jag

Attachment: pgp00013.pgp
Description: PGP signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []