ssanderson / python-interface

Minimal Pythonic Interface Definitions
https://interface.readthedocs.io/en/latest/
Apache License 2.0
111 stars 16 forks source link

import interface does not work for me: need to use import Interface #6

Closed VictorNorman closed 6 years ago

VictorNorman commented 6 years ago

I got everything to work by doing

from Interface import Interface

and

from Interface import implements

Using the lowercase interface, I get ImportError: No module named 'interface'.

I'm wondering if this surprises you... Or am I using some other installation of software.

My setup is:

Mac52078:~/classes/design_patterns/python_ifaces vtn2$ python3 Python 3.5.2 (default, Jun 29 2016, 13:43:58) [GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin Type "help", "copyright", "credits" or "license" for more information.

import Interface

My site-packages includes:

Mac52078:~/classes/design_patterns/python_ifaces vtn2$ ls /usr/local/lib/python3.5/site-packages/ BTrees/ transaction/ BTrees-4.4.1.dist-info/ transaction-2.1.2.dist-info/ ComputedAttribute/ wheel/ ExtensionClass/ wheel-0.29.0-py3.5.egg-info/ ExtensionClass-4.3.0.dist-info/ zc/ Interface/ zc.lockfile-1.2.1-py3.5-nspkg.pth Interface-2.11.1.dist-info/ zc.lockfile-1.2.1.dist-info/ MethodObject/ zdaemon/ OleFileIO_PL.py zdaemon-4.2.0.dist-info/ PIL/ zodbpickle/ Pillow-4.1.1.dist-info/ zodbpickle-0.7.0.dist-info/ ZConfig/ zope/ ZConfig-3.2.0.dist-info/ zope.browser-2.2.0-py2.7-nspkg.pth ZEO/ zope.browser-2.2.0.dist-info/ ZEO-5.1.0.dist-info/ zope.component-4.4.1-py3.4-nspkg.pth ZODB/ zope.component-4.4.1.dist-info/ ZODB-5.3.0.dist-info/ zope.configuration-4.1.0-py2.7-nspkg.pth ZODB3-3.11.0.dist-info/ zope.configuration-4.1.0.dist-info/ pycache/ zope.contenttype-4.3.0-py2.7-nspkg.pth _cffi_backend.cpython-35m-darwin.so zope.contenttype-4.3.0.dist-info/ cffi/ zope.event-4.3.0-py3.5-nspkg.pth cffi-1.11.0.dist-info/ zope.event-4.3.0.dist-info/ easy_install.py zope.exceptions-4.2.0-py3.4-nspkg.pth olefile/ zope.exceptions-4.2.0.dist-info/ olefile-0.44.dist-info/ zope.globalrequest-1.4-py2.7-nspkg.pth persistent/ zope.globalrequest-1.4.dist-info/ persistent-4.2.4.2.dist-info/ zope.i18n-4.2.0-py2.7-nspkg.pth pip/ zope.i18n-4.2.0.dist-info/ pip-9.0.1.dist-info/ zope.i18nmessageid-4.1.0-py3.5-nspkg.pth pkg_resources/ zope.i18nmessageid-4.1.0.dist-info/ pycparser/ zope.interface-4.4.3-py3.5-nspkg.pth pycparser-2.18.dist-info/ zope.interface-4.4.3.dist-info/ pymunk/ zope.location-4.1.0-py3.6-nspkg.pth pymunk-5.3.2.dist-info/ zope.location-4.1.0.dist-info/ pymunkoptions/ zope.proxy-4.3.0-py3.5-nspkg.pth python_interface-1.2.0.dist-info/ zope.proxy-4.3.0.dist-info/ pytz/ zope.publisher-4.3.2-py2.7-nspkg.pth pytz-2017.3.dist-info/ zope.publisher-4.3.2.dist-info/ setuptools/ zope.schema-4.5.0-py3.4-nspkg.pth setuptools-23.1.0-py3.5.egg-info/ zope.schema-4.5.0.dist-info/ sitecustomize.py zope.security-4.2.0-py3.5-nspkg.pth six-1.11.0.dist-info/ zope.security-4.2.0.dist-info/ six.py zope.traversing-4.2.0-py2.7-nspkg.pth terryfy/ zope.traversing-4.2.0.dist-info/

ssanderson commented 6 years ago

@VictorNorman it looks like you installed the interface python package, which is standalone distribution of zope.interface. This package should be installed via pip install python-interface. The two packages provide similar functionality, but are otherwise unrelated.