Skip to content

Namespace issue with DesignUnit #100

Description

@domWalters

In __init__.py, the DesignUnit class is imported from the DesignUnit file and retains its name.

As a result, it overwrites the DesignUnit module.

So, the following causes an error:

import pyVHDLModel

class LibraryClause(pyVHDLModel.DesignUnit.LibraryClause):
    ...
    class LibraryClause(pyVHDLModel.DesignUnit.LibraryClause):
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E   AttributeError: type object 'DesignUnit' has no attribute 'LibraryClause'

This is because type(pyVHDLModel.DesignUnit) == <class DesignUnit>.

You have to do a from ... import to avoid this issue:

from pyVHDLModel.DesignUnit import LibraryClause as BaseLibraryClause

class LibraryClause(BaseLibraryClause):
    ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Model: Design UnitRelated to Design Units (Entity, Architecture, Package, PackageBody, Configuration, Context).Problem Report

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions