Reputation: 53
I downloaded a python project from github:
to work with interface file of ubuntu. the problem is when I try to use the module as the Readme said I get this:
Traceback (most recent call last):
File "./ss.py", line 7, in <module>
adapters = debinterface.interfaces()
AttributeError: 'module' object has no attribute 'interfaces'
my ss.py
script is:
#!/usr/bin/python
import debinterface
import sys
sys.path.append("/home/ed/Downloads/netpy/")
sys.path.append("/home/ed/Downloads/netpy/debinterface/")
adapters = debinterface.interfaces()
I run this script within "/home/ed/Downloads/netpy/"
that consists of "debinterface"
. I have to say that I tried that script without "sys.path.append"
but nothing changed, even I changed the module name "debinterface"
to "debeh"
but again nothing changed too.
what is my problem?
Upvotes: 2
Views: 5584
Reputation: 1319
Well, I got it working doing the following:
Changed the import statement:
from debinterface.interfaces import interfaces
And finally, called interfaces:
adapters = interfaces()
Upvotes: 0
Reputation: 25528
This looks like a bug in the documentation or the package code to me. You can use
from debinterface.interfaces import interfaces
and then refer to your the interface
class with
adapters = interfaces()
or edit debinterface/__init__.py
to do the import of interface
module for you when you import the debinterface
package. Add the line
from interfaces import interfaces
to the __init__.py
file.
Upvotes: 2