Open afreiberger opened 4 years ago
introduced by PR #456
This is a bit odd. I just did this in py2 on a bionic host:
Python 2.7.18rc1 (default, Apr 7 2020, 12:05:55)
Type "copyright", "credits" or "license" for more information.
IPython 5.10.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import charmhelpers.core.hookenv
In [2]: ls
bin/ debian/ HACKING.md Makefile py2venv/ requirements.txt setup.cfg tarmac_tests.sh* tests/ tox.ini
charmhelpers/ docs/ LICENSE MANIFEST.in README.rst scripts/ setup.py test-requirements.txt tools/
In [3]: import enum
In [4]:
Is it an old py2 version?
I don't still have my artifacts, but it may have been xenial and/or trusty. I ran into it during pretty standard deployment during zaza testing of lp:charm-rsyslog-forwarder-ha.
https://git.launchpad.net/~afreiberger/charm-rsyslog-forwarder-ha/commit/?id=ad9186b5c9fcce2d386d2459da6d03684330f8a7
There's not an automated test, but this commit above updated charmhelpers and broke trusty and possibly xenial support for the charm due to the enum.
Sorry for lack of more sufficient info.
Okay, my notes show that the way my program was written was using /usr/bin/env python and breaking in focal on the charmhelpers import. But I also had found that my install hook was installing py2 packages python-six, python-sqlalchemy, etc instead of detecting python version. So, it may be that I was running into complicated python versioning issues crossing over into supporting focal with assumption that /usr/bin/env python was py2.
Eventually, I just rewrote as py3 and dropped trusty support.
This is a bit odd. I just did this in py2 on a bionic host:
Python 2.7.18rc1 (default, Apr 7 2020, 12:05:55) Type "copyright", "credits" or "license" for more information. IPython 5.10.0 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details. In [1]: import charmhelpers.core.hookenv In [2]: ls bin/ debian/ HACKING.md Makefile py2venv/ requirements.txt setup.cfg tarmac_tests.sh* tests/ tox.ini charmhelpers/ docs/ LICENSE MANIFEST.in README.rst scripts/ setup.py test-requirements.txt tools/ In [3]: import enum In [4]:
Is it an old py2 version?
@ajkavanagh you might have package python-enum34 installed (which backports enum for py2). I've run into this as well when developing on my workstation: everything looked good until I deployed the charm on a fresh bionic unit ;)
@ajkavanagh you might have package python-enum34 installed (which backports enum for py2). I've run into this as well when developing on my workstation: everything looked good until I deployed the charm on a fresh bionic unit ;)
That's an interesting point. I tested it on a fresh lxc bionic and it's not installed. Good catch!
After refreshing charmhelpers on a python2 charm, I ran into issues during import of hookenv and host due to bare import of enum (available in python3.4+)
I've updated my code to run on python3 to workaround this. Is there a requirement for python3 for v0.20.16?
Is there a stable charm-helpers tagged release that supports py2?