New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[msilib] Obscure exception message when trying to open a non-existent MSI database #56591
Comments
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 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 "<stdin>", line 1, in <module>
_msi.MSIError: unknown error 6e
>>> |
changed the headline of the defect for something more meaningful :) |
The following two error conditions that can be returned by MsiOpenDatabase do not have specific handling: ERROR_CREATE_FAILED (1631) ERROR_OPEN_FAILED (110) (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 ? |
This sounds OK as long as the error message is explicit :) |
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. |
Found this a simple fix for an annoying and time consuming error. Patched as discussed earlier and decided to leave the filename out. |
Thank you for your patch, William. I added a test case, a NEWS entry and committed it to 3.6 and master branches. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: