-
Notifications
You must be signed in to change notification settings - Fork 18
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
Error on importing pywbem.cim_http and pywbem.cim_operations #54
Comments
Sorry, not sure I understand the issue. So what is the error you experienced? Did you fix the code yourself or was something inside pywbem broken and fixed? |
The API in pywbem changed in 1.0.0. From https://pywbem.readthedocs.io/en/stable_1.1/changes.html#pywbem-1-0-0b1 "Made all sub-namespaces within the pywbem namespace private, except for pywbem.config. Specifically, renamed the following modules by prepending an underscore character: cim_constants.py, cim_http.py, cim_obj.py, cim_operations.py, cim_types.py, cim_xml.py, exceptions.py, mof_compiler.py, moflextab.py, mofparsetab.py, tupleparse.py, tupletree.py. Using these sub-namespaces had been deprecated in pywbem 0.8.0. This change is compatible for users that followed the recommendation to import only the symbols from the pywbem namespace. Users that imported symbols from these sub-namespace should now import them from the pywbem namespace. If you miss a symbol in the pywbem namespace, it was likely a symbol that is not part of the public pywbem API. (See issue pywbem/pywbem#1925)" |
workaround is to stick with an earlier version of pywbem, e.g.
|
Or apply this patch, which should work with pywbem 0.8.0 and later:
|
Thx @philrandal for sharing the knowledge. Will take a closer look at this. Maybe either ditch support for the old pywbem 0.7.x or have the connection check twice depending on the pywbem version. |
You could have separate try ... except blocks depending on pywbem version, for backwards compatibility |
Yes, that's what I meant with "check twice depending on the pywbem version". It's basically only RHEL and CentOS which still ship the old pywbem :-/ |
Hi there! I think this issue can be closed. |
@Napsty hi there! can you please reopen this issue? I thought it was fixed with the latest version but it's not the case 😢 During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/nagios/plugins/check_esxi_hardware.py", line 757, in <module>
except pywbem.cim_operations.CIMError as args:
^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pywbem' has no attribute 'cim_operations'. Did you mean: '_cim_operations'? pip list | grep pywbem
pywbem 1.7.2 |
Will look at it soon, should be easier to fix now that old version compatibilities for python2 and pywbem 0.7.0 have been removed. |
Part of the code already used pywbem._cim, but two places were missed. This patch should fix it:
|
Hi, I've got those import errors, but investigating current version of pywbem gived me a clue that those two should be
pywbem._cim_http
andpywbem._cim_operations
. That fix inside code worked for py3 and py2.The text was updated successfully, but these errors were encountered: