#233 The qcow2 inventory script from master shows a warning on Fedora 28
Closed 5 years ago Opened 5 years ago by till.

/usr/lib/python2.7/site-packages/fmf/base.py:86: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  while ".fmf" not in next(os.walk(root))[1]:

@psss will next patch help ??? :

diff --git a/inventory/standard-inventory-qcow2 b/inventory/standard-inventory-qcow2
index 7952c03..89765c1 100755
--- a/inventory/standard-inventory-qcow2
+++ b/inventory/standard-inventory-qcow2
@@ -200,7 +200,7 @@ class FmfMetadataTree(object):
         if self.path != path or self.tree is None:
             FmfMetadataTree.path = path
             try:
-                FmfMetadataTree.tree = fmf.Tree(path)
+                FmfMetadataTree.tree = fmf.Tree(unicode(path))
             except Exception:
                 """Fmf initialization failed. Do not try initialize further for this path.
                 """

BTW, are you using from __future__ import unicode_literals in STR? I think it's probably a good idea to slowly prepare the code to be python3 compatible...

I guess it should help here. But that would work with Python 2 only. If you import unicode_literals it should work for both Python 2 and Python 3. Depends where/how exactly the path is defined.

@psss let's keep issues fine-grained.
PR #234 fixes this issue.
Supporting unicode_literals in STR is independent task/issue that requires changing all python code in STR in batch. @psss you can open a new issue about supporting unicode_literals.

Metadata Update from @astepano:
- Issue status updated to: Closed (was: Open)

5 years ago

Login to comment on this ticket.

Metadata