Simple change that gets rid of FutureWarning under python 2.7
Created originally on Bitbucket by codeape (Bernt R. Brenna)
Under python 2.7 I get the following warning when opening a workbook:
{{{ FutureWarning: The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead. if names_root: }}}
Simple change gets rid of the warning.
{{{ diff -r f4175c8bd3f8 openpyxl/reader/workbook.py --- a/openpyxl/reader/workbook.py Tue Nov 16 09:56:44 2010 +0100 +++ b/openpyxl/reader/workbook.py Wed Nov 17 12:50:30 2010 +0100 @@ -100,7 +100,7 @@ root = fromstring(xml_source) names_root = root.find(QName('http://schemas.openxmlformats.org/spreadsheetml/2006/main', 'definedNames').text)
- if names_root:
-
if names_root is not None:
for name_node in names_root.getchildren(): range_name = name_node.get('name')
}}}