This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Jason Matthew
Recipients Jason Matthew
Date 2017-01-24.18:54:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1485284065.77.0.143549147327.issue29364@psf.upfronthosting.co.za>
In-reply-to
Content
Fairly new to MSIs here.  Working towards extracting the same information which is available via Orca graphical interfaces.  

I believe I've hit a bug within _msi.View class, namely the inability to safely determine the number of records in my result.  

Examples I've found depicting how to obtain query results lead me to believe _msi.View.Fetch() will return None if no more rows exist.  My development using python 2.7.11, Windows 7 enterprise and 2.7.13, Windows Server 2016, has shown Fetch() will raise a msilib.MSIError when no more rows are available.  MSIError is commonly used within msilib which means explicit error handling (or leniency in this case) may incorrectly suppress other error scenarios.

Entering a bug with the hope either a patch addresses this issue or documentation can be updated to reflect proper usage.  Example provided below.


    >>> import msilib
    >>> db = msilib.OpenDatabase("msi-1.0.0.8.msi", msilib.MSIDBOPEN_READONLY)
    >>> v = db.OpenView("select * from Property")
    >>> v.Execute(None)
    >>> while 1:
    ...     r = v.Fetch()
    ...     if not r:break
    ...     print r.GetString(1)
    ...
    UpgradeCode
    WixSharp_UI_INSTALLDIR
    WixSharp_InstallDialogs
    WIXUI_INSTALLDIR
    Manufacturer
    ProductCode
    ProductLanguage
    ProductName
    ProductVersion
    SecureCustomProperties
    Traceback (most recent call last):
      File "<stdin>", line 2, in <module>
    _msi.MSIError: unknown error 103
History
Date User Action Args
2017-01-24 18:54:25Jason Matthewsetrecipients: + Jason Matthew
2017-01-24 18:54:25Jason Matthewsetmessageid: <1485284065.77.0.143549147327.issue29364@psf.upfronthosting.co.za>
2017-01-24 18:54:25Jason Matthewlinkissue29364 messages
2017-01-24 18:54:25Jason Matthewcreate