Thierry, In the current template, charmhelpers is installed using pip, and the path you mentioned is the system package path for Python 2.7, so it should be on the path by default. I just created a new charm using the template and confirmed that it was able to import charmhelpers from that location.
Are you by chance modifying the files generated by the template to use Python 3 instead of Python 2.7? If so, you will also need to change hooks/setup.py to install and use pip3 (python3-pip) instead. Alternatively, if you are making any changes to the path in your charm, you should be careful to include /usr/local/lib/python2.7/dist-packages, as that is where any system-level Python libraries will be installed (again, only for Python 2.7, not Python 3). Also note that if you are using a virtualenv, you would need to delay calling setup.pre_install() until after the virtualenv is created and activated, so that charmhelpers would be installed into the virtualenv. (You could also then remove the `apt-get install python-pip`, since mkvirtualenv installs pip for you.) Note that it was decided that the framework is still not widely accepted or understood enough to be the default template, so the next version of Charm Tools will change or remove the default selection for the template, which will affect this, as well. On Thu, Feb 26, 2015 at 3:46 AM, Thierry [email protected] <[email protected]> wrote: > Hello charm developpers, > > Creating a new charm python template now integrates load of charmhelpers > package (setup.py script) which is good. > Then template for start/stop script do call service.py for service > management. > The problem I saw is that charmhelpers package is installed in > /usr/local/lib/python2.7/dist-packages/charmhelpers and that path is not > integrated by default in the search path. > Is this a bug or should we had a > sys.path.append('/usr/local/lib/python2.7/dist-packages/') in service.py > script ? > > Let me know if there is anything you want me to do for that > Thanks > > -- > Thierry Fauck @ linux.vnet.ibm > > > -- > Juju mailing list > [email protected] > Modify settings or unsubscribe at: > https://lists.ubuntu.com/mailman/listinfo/juju -- Juju mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/juju
