[U-Boot] [PATCH 3/8] test/py: Import 'configparser' lower case to be python 3.x safe
Stephen Warren
swarren at wwwdotorg.org
Thu Sep 14 20:26:22 UTC 2017
On 09/14/2017 02:06 PM, Paul Burton wrote:
> In python 3.x the configparser module is named with all lower case.
> Import it as such in order to avoid errors when running on python 3.x,
> and fall back to the CamelCase version in order to keep working with
> python 2.x.
> diff --git a/test/py/conftest.py b/test/py/conftest.py
> +try:
> + import configparser as ConfigParser
> +except:
> + import ConfigParser
Nit: Since Python 3 is the future, I wonder if we want to bias the code
towards it:
try:
import configparser
except:
import ConfigParser as configparser
... and conver the one use of ConfigParser below to configparser?
Similarly, it might make sense to do something similar in the next
patch; Python 3 code in "try", and Python 2 compatibility code in "except".
That said, the code works fine either way, so I don't care much whether
you make this change.
More information about the U-Boot
mailing list