Sorry for all the questions and thank you for the help.
I have the following code that I'm working for school. I'm trying to import the Cerberus package into my code with "import cerberus" and that works with no problems. However, when I run the code I get the following message "AttributeError: 'module' object has no attribute 'Validator'" Looking over the documentation on Cerberus, it appears I'm doing calling the right things with "import cerberus" and "validator = cerberus.Validator()" or "validator = cerberus.Validate()"
Can someone explain to me what I'm doing wrong? I've been bashing my head for weeks on this problem. Thanks for the assistance, it's greatly appreciated.
import cerberus
validator = cerberus.Validator()
Related
I am having having the error bellow while running my program. I believe there have been some updates on_ PyAudioAnalysis
AttributeError: module 'pyAudioAnalysis.audioTrainTest' has no attribute 'featureAndTrain'
I am wondering if there is a possibility to update this script:
from pyAudioAnalysis import audioTrainTest as aT
aT.featureAndTrain("...")
Thank you :)
Could not find an answer addressed to this issue online
I am three weeks into my independent study Python course, and am having trouble getting passed an issue. I am trying to use the function enterbox() from easygui I write:
import easygui
value = easygui.enterbox("say something")
And when I run it I get the error:
**AttributeError: 'module' object has no attribute 'enterbox'
Does anyone know why this may be happening? Thanks! (I'm using version 2.7)
It's been a while since I have used Python and am stumbling already at a simple import!
statements.py:
str = "hello"
main.py:
import statements
print statements.str
Obviously the final program will have more going on, and the statements will be stuff like URLs. For this simple example however with both files sitting side by side in the same folder I get the following error on running main.py:
AttributeError: 'module' object has no attribute 'str'
I know I am doing something terribly silly, but I can't see what it is. Searching around it looks fine. Any help/insight is appreciated.
You used the import statement correctly. The error then can be caused by either importing a different module with the same name, or by having altered the module after already having imported it.
You can check print statements.__file__ to see what module Python found instead when importing, and you can use the reload() function to ask Python to reload the module from disk if you altered it.
I just started to use Python so the following might be a really REALLY dumb question but I searched the web for a long time and didn't find anything.
I'm trying to use the XMMS2 client from a Django View. Here is what I have in my views.py:
import xmmsclient
import os
import sys
def list(request):
xmms = xmmsclient.XMMS("tutorial1")
xmms.connect(os.getenv("XMMS_PATH"))
result = xmms.playlist_list_entries()
result.wait()
...
And here is the error I get:
AttributeError at /xmms2/list/
'module' object has no attribute 'XMMS'
And the line in question is this:
xmms = xmmsclient.XMMS("tutorial1")
The view works fine if I remove all the code and replace it with (for example):
return HttpResponse("list")
I first thought there was a problem with the xmmsclient library but it works fine when I run this xmms2-tutorial example
So I guess there is some sort of incompatibility between Django and xmmsclient but I really don't have a clue.
I'm running Ubuntu 12.04, Python 2.7.3, Django 1.4.1 and XMMS2 0.8
Any help will be really appreciated!
The problem was a name conflict. My Django app name was "xmmsclient".
So when I did
xmmsclient.XMMS("tut1")
I was referring to my app module, not the one from the XMMS2 client library.
Thanks a lot to Erik Massop from the xmms2-devel list!
I have this really weird python problem and I really need to help to figure this out
When I run
#!/usr/bin/python
import socket
socket.getaddrinfo("www.google.com", 80)
I get this error
socket.getaddrinfo("www.google.com", 80)
AttributeError: 'module' object has no attribute 'getaddrinfo'
Can anyone help me with this
Thank you
Don't you have file named 'socket.py' in your work space?
If so, you should rename it, or put it into some subdirectory.