Issue 12382: [msilib] Obscure exception message when trying to open a non-existent MSI database (original) (raw)

Created on 2011-06-21 12:12 by Robin.Jarry, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
12382_msi-open-error-message.patch tiwilliam,2014-04-29 21:09 review
Pull Requests
URL Status Linked Edit
PR 4528 merged berker.peksag,2017-11-23 18:53
PR 4538 merged python-dev,2017-11-24 09:55
Messages (9)
msg138781 - (view) Author: Robin Jarry (Robin.Jarry) Date: 2011-06-21 12:12
When trying to open a non existing MSI database, an obscure "unknown error 6e" is raised. Could it be possible to get a more explicit message such as "File not found" or whatever ? Thanks :) Here is a example: -------------------------------- D:\>ll total 0 drwxr-xr-x 4 tcinteg Administ 0 Nov 30 2010 RECYCLER drwxr-xr-x 0 tcinteg Administ 0 Jul 6 2009 System Volume Information drwxr-xr-x 4 tcinteg Administ 0 Apr 29 16:03 TC drwxr-xr-x 3 tcinteg Administ 0 Apr 29 15:43 stgloc D:\>python Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import msilib >>> db = msilib.OpenDatabase("I_Do_Not_Exist.msi", msilib.MSIDBOPEN_READONLY) Traceback (most recent call last): File "", line 1, in _msi.MSIError: unknown error 6e >>>
msg138782 - (view) Author: Robin Jarry (Robin.Jarry) Date: 2011-06-21 12:18
changed the headline of the defect for something more meaningful :)
msg139024 - (view) Author: Mark Mc Mahon (markm) * Date: 2011-06-25 08:10
The following two error conditions that can be returned by MsiOpenDatabase do not have specific handling: ERROR_CREATE_FAILED (1631) The database could not be created. ERROR_OPEN_FAILED (110) The database could not be opened as requested. (the messages are those copied from MSDN). Should extra cases for these go into the case statement in msierror? or should they be handled directly in OpenDatabase. Does the error text above sound OK - should we add ": '%s'" % msi_file ?
msg139049 - (view) Author: Robin Jarry (Robin.Jarry) Date: 2011-06-25 12:14
This sounds OK as long as the error message is explicit :)
msg139203 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2011-06-26 19:49
I'd add them to msierror, with no inclusion of the file name. If you want the file name in the exception, you should uniformly apply this to all errors in OpenDatabase, and then subclass MSIError to, say, MSIOpenError which includes a .filename attribute.
msg217552 - (view) Author: William Tisäter (tiwilliam) * Date: 2014-04-29 21:09
Found this a simple fix for an annoying and time consuming error. Patched as discussed earlier and decided to leave the filename out.
msg306880 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2017-11-24 09:54
New changeset 4864a619dc1cc9092780ccf5a6327e8abf66133d by Berker Peksag in branch 'master': bpo-12382: Make OpenDatabase() raise better exception messages (GH-4528) https://github.com/python/cpython/commit/4864a619dc1cc9092780ccf5a6327e8abf66133d
msg306883 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2017-11-24 10:31
New changeset bfa89b21e119bac7fed4a5decc26f1fff8ec359e by Berker Peksag (Miss Islington (bot)) in branch '3.6': bpo-12382: Make OpenDatabase() raise better exception messages (GH-4528) https://github.com/python/cpython/commit/bfa89b21e119bac7fed4a5decc26f1fff8ec359e
msg306884 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2017-11-24 10:32
Thank you for your patch, William. I added a test case, a NEWS entry and committed it to 3.6 and master branches.
History
Date User Action Args
2022-04-11 14:57:18 admin set github: 56591
2017-11-24 10:32:50 berker.peksag set status: open -> closedcomponents: + Library (Lib)versions: + Python 3.6, Python 3.7, - Python 2.7, Python 3.5nosy: + paul.moore, zach.ware, steve.dowermessages: + resolution: fixedstage: patch review -> resolved
2017-11-24 10:31:23 berker.peksag set messages: +
2017-11-24 09:55:10 python-dev set pull_requests: + <pull%5Frequest4472>
2017-11-24 09:54:04 berker.peksag set messages: +
2017-11-23 18:53:20 berker.peksag set stage: patch reviewpull_requests: + <pull%5Frequest4464>
2017-11-19 07:07:09 berker.peksag set nosy: + berker.peksag
2014-04-29 21:09:12 tiwilliam set files: + 12382_msi-open-error-message.patchcomponents: + Windows, - Library (Lib)versions: + Python 3.5keywords: + patchnosy: + tiwilliammessages: +
2011-06-26 19:49:52 loewis set messages: +
2011-06-25 12:14:20 Robin.Jarry set messages: +
2011-06-25 08:10:01 markm set nosy: + markmmessages: +
2011-06-21 12:23:07 tim.golden set nosy: + markmcmahon, tim.golden
2011-06-21 12🔞05 Robin.Jarry set messages: + title: [msilib] Ambiguous exception message when trying to open a non existing MSI database -> [msilib] Obscure exception message when trying to open a non-existent MSI database
2011-06-21 12:12:16 Robin.Jarry create