[Yum] yum: rpmUtils module does not contain transaction?
james-yum at and.org
Sun Dec 21 07:29:49 UTC 2008
Felix Schwarz <felix.schwarz at web.de> writes:
> I wanted to debug some other program which uses the rpmUtils
> package. The problem is that they do:
>> import rpmUtils
>> ts = rpmUtils.transaction.initReadOnlyTransaction()
> With Python 2.5.1 (Fedora 8) this fails:
>> AttributeError: 'module' object has no attribute 'transaction'
> And indeed, in rpmUtils/__init__.py there is no symbol named
> transaction. But there is a module called rpmUtils/transaction.py so
> this works for me:
>> from rpmUtils import transaction
>> ts = transaction.initReadOnlyTransaction()
> However, the first pattern is used even in yum 3.2.20 so probably some
> Python wizard can explain this to me?
It's kind of a magic python thing, if python sees:
...in _any_ module, then it "knows" in all other modules that it
exists. So you if you "import yum", before you import rpmUtils then
you don't need to do the above.
We should probably just fix the rpmUtils/__init__.py to import
everything, but noone has bothered.
James Antill -- james at and.org
C String APIs use too much memory? ustr: length, ref count, size and
read-only/fixed. Ave. 44% overhead over strdup(), for 0-20B strings
More information about the Yum