attributeerror

How do I make a grid of empty lists in numpy that 'accepts' appending?

喜欢而已 提交于 2019-12-12 04:58:09
问题 I am trying to use numpy.append but something goes wrong and it just doesn't make sence to me anymore. Can someone explain why I am getting an error? >>> np.array([[], [], []]).shape (3, 0) >>> a=[[], [], []] >>> a[1].append(3) >>> a [[], [3], []] >>> b=np.array(a) >>> b[0].append(3) array([[3], [3], []], dtype=object) This is all logical to me, yet when I try the following it stops working. >>> c=np.array((3,0),dtype=object) >>> c[0].append(3) AttributeError: 'int' object has no attribute

module object has no attribute open in shelve [duplicate]

 ̄綄美尐妖づ 提交于 2019-12-12 04:54:36
问题 This question already has answers here : Importing installed package from script raises “AttributeError: module has no attribute” or “ImportError: cannot import name” (2 answers) Closed 2 months ago . Following is my code, import shelve sd = shelve.open("session.data") When I try the same code in IDLE , I am not getting any error. But when running the script with this code, I am getting the following error, Traceback (most recent call last): File "try.py", line 3, in <module> sd = shelve.open

Pyttsx: AttributeError: 'module' object has no attribute 'init'

时光总嘲笑我的痴心妄想 提交于 2019-12-12 04:46:06
问题 Hi to everyone and thanks in advance import pyttsx engine = pyttsx.init() engine.say('Hello World') engine.runAndWait() And I get this error: Traceback (most recent call last): File "C:\Users\xxx\eclipse\workspace\Ai_Project\AI\Ai_Brain.py", line 8, in <module> engine = pyttsx.init() AttributeError: 'module' object has no attribute 'init' I am on Windows 7 using Python 2.7 and eclipse neon. Is this some kind of compatibility issue? I have searched a lot of related questions but applying the

AttributeError: 'function' object has no attribute 'self'

≡放荡痞女 提交于 2019-12-12 03:23:23
问题 I have a gui file and I designed it with qtdesigner, and there are another py file. I tried to changing button name or tried to add item in listwidget but I didn't make that things. I got an error message. My codes; from gui import Ui_mainWindow import sys from PyQt5 import QtCore, QtGui, QtWidgets import main class Music(QtWidgets.QMainWindow, Ui_mainWindow): def __init__(self): super().__init__() self.setupUi(self) self.search_button.clicked.connect(self.searchbutton) def searchbutton(self)

AttributeError: After converting python script to EXE by Pyinstaller

China☆狼群 提交于 2019-12-12 02:17:24
问题 I have made a python script for calculations purposes, importing libraries, Tkinter, Pmw, sympy, math, tkfiledialog, webbrowser. Now, by using Pyinstaller I convert it into an EXE application. When I run it, it gives the error: WindowsError: [Error 3] The system cannot find the path specified: 'C:\\Python27\\Earthing\\dist\\Earthing\\Pmw/*.*' So, I copy and paste the entire Pmw directory on this location. However, after doing this, I get the error: AttributeError: 'module' object has no

AttributeError: 'NoneType' object has no attribute 'add'

孤街醉人 提交于 2019-12-11 21:59:44
问题 I got the following error AttributeError: 'NoneType' object has no attribute 'add' while I tried this. not_yet_bought_set = set() . . . for value in set_dict.itervalues(): for item in value: not_yet_bought_set = not_yet_bought_set.add(item) I dont't get why I got this error, is it because I always make not_yet_bought_set new? I make this, because when I only do not_yet_bought_set.add(item) there wont be all the items from all values. I do not know why. value are sets and not_yet_bought_set

Starting Celery with supervisord: AttributeError: 'module' object has no attribute 'celery'

放肆的年华 提交于 2019-12-11 18:00:06
问题 I used to have all my Flask app code and celery code in one file and it worked fine with supervisor. However, it is very hair so I split my tasks to celery_tasks.py and this problem occurs. In my project directory, I can start celery manually with the following command celery -A celery_tasks worker --loglevel=INFO However, because this is a server, I need celery to run as a daemon in background. But it shows following error when I called sudo supervisorctl restart celeryd celeryd: ERROR

Django: QuerySet object has no attribute

放肆的年华 提交于 2019-12-11 15:03:10
问题 I get an AttributeError: 'QuerySet' object has no attribute 'ratings' when trying to do something like this in my view: def index(request): thing_list = Thing.ratings.cumulative_score() return render(request, 'index.html', {'thing_list':thing_list}) My model: from ratings.models import Ratings class Thing(models.Model): user = models.ForeignKey(User) ... rating = Ratings() While using django-simple-ratings app. This link references where cumulative_score is defined in that module. How do I

Issues with pyinstaller and reportlab

£可爱£侵袭症+ 提交于 2019-12-11 12:47:42
问题 Alright so I have a python project that I want to compile, so I decided to use pyinstaller (first time compiling python). Now it compiled fine but when I run the exe it returns -1. So after a bit of messing around I figured out that it was related to reportlab.platypus. So my first instinct was to check to see if using hooks changed anything, so I tried adding the reportlab.pdfbase._fontdata and reportlab.lib.utils hooks (these were the only hook files I could find related to reportlab).

xlwings Workbook() call returns AttributeError: Open.Application

倖福魔咒の 提交于 2019-12-11 10:43:54
问题 Hope you can help me out, first question I ask myself but I am always impressed by the professional answers I find here! I am using xlwings to both read and write data from .xls files. I am not a seasoned programmer, and I make mistakes. From time to time, this means rebooting processes, Python and what-not. Every now and again, I would get the following AttributeError upon calling Workbook() . The real problem is not that I don't have a clue what is happening (I tried reading the modules the