Post-reorg, importing interfaces is sometimes broken

Bug #384831 reported by Gavin Panella
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Medium
Jonathan Lange

Bug Description

After the migration of the bugs code to the lp/bugs tree, there seem
to be problems importing interfaces. The following occurs:

    $ python2.4
    >>> import _pythonpath
    >>> import lp.bugs.interfaces.bug
    Traceback (most recent call last):
    ...
    ImportError: cannot import name IBug

This was causing problems in several scripts, e.g. update-cve.py.

A temporary workaround:

    >>> import canonical.launchpad.interfaces

has been added to lib/lp/bugs/interfaces/__init__.py after discussion
with Bjorn. This bug is to remind us to fix this crufty hack.

Tags: lp-bugs qa-ok

Related branches

Revision history for this message
Данило Шеган (danilo) wrote :

I am hitting into a lot of circular import problems because of this now (trying to migrate translations code to a new layout as well). This seems to mainly affect scripts.

Running in 'make harness' does not exhibit the same issues, so it seems that scripts might use xmlconfig.file('script.zcml') call that is done by make harness as well.

Doing that makes it all work without that ugly trick:

    $ python2.4
    >>> import _pythonpath
    >>> from zope.configuration import xmlconfig
    >>> xmlconfig.file('script.zcml')
    <zope.configuration.config.ConfigurationMachine object at 0x7f65d8c8a690>
    >>> import lp.bugs.interfaces.bug
    >>>

Revision history for this message
Данило Шеган (danilo) wrote :

Note that this is not because of your workaround: it just makes it hard for me to debug, because circular imports go into a loop into bugs interfaces. I am just struggling to find a same simple workaround for translations now (and only for scripts), other than using above trick with xmlconfig, which emits an ugly deprecation warning from zope conf files.

Changed in malone:
milestone: 2.2.6 → 2.2.7
Changed in malone:
milestone: 2.2.7 → none
Changed in malone:
milestone: none → 10.11
Revision history for this message
Launchpad QA Bot (lpqabot) wrote : Bug fixed by a commit
tags: added: qa-needstesting
Changed in malone:
assignee: nobody → Jonathan Lange (jml)
status: Triaged → Fix Committed
Jonathan Lange (jml)
tags: added: qa-ok
removed: qa-needstesting
Revision history for this message
Henning Eggers (henninge) wrote :

Need to keep this branch from being deployed until I can talk to a losa about the qastaging breakage.

tags: added: qa-bad
removed: qa-ok
tags: added: qa-ok
removed: qa-bad
Changed in malone:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.