attributeerror

Error in py2app application

假装没事ソ 提交于 2020-01-07 07:54:05
问题 (OSX = Mountain lion) My app in /dist throws the error: Last login: Wed Aug 28 11:21:29 on ttys001 -MacBook-Pro:~ $ /Users/Desktop/dist/abc.app/Contents/MacOS/abc ; exit; Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/py2app/apptemplate/lib/site.py", line 20, in <module> import os File "os.pyc", line 398, in <module> File "UserDict.pyc", line 83, in <module> File "_abcoll.pyc", line 11, in <module> File "/Users/Virendra/Desktop/dist/abc.app/Contents/Resources

AttributeError: 'int' object has no attribute '_erase'

安稳与你 提交于 2020-01-06 09:06:51
问题 I am trying to make a game where you have to avoid objects falling from the sky. I am a beginner programmer (14yrs old) so I make a lot of mistakes. I solve all of them(for this program) but i dont know how to fix this one. The error is in title. Thank you. Full code: from livewires import games, color import random games.init(screen_width = 1280, screen_height = 720, fps = 150) class Covjek(games.Sprite): def update(self): if self.overlapping_sprites: self.destroy() games.screen.quit() self

Python scraping go to next page using BeautifulSoup [closed]

送分小仙女□ 提交于 2020-01-06 07:12:59
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . This is my scraping code: import requests from bs4 import BeautifulSoup as soup def get_emails(_links:list): for i in range(len(_links)): new_d = soup(requests.get(_links[i]).text, 'html.parser').find_all('a', {'class':'my_modal_open'}) if new_d: yield new_d[-1]['title'] start=20 while True: d = soup(requests.get(

Django South migration AttributeError

浪子不回头ぞ 提交于 2020-01-03 17:34:53
问题 I'm suffering from this error when migrating South (0.7.5) in Django (1.4). I recently changed the Timezone setting to false, i.e. USE_TZ = False to fix another problem. Any ideas? Thanks ~/code/django/ssc/dev/ssc/ssc: python manage.py migrate crewcal Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in

Python - TypeError: unbound method

拥有回忆 提交于 2020-01-02 04:47:07
问题 So this Python problem has been giving me problems since I've tried refactoring the code into different files. I have a file called object.py and in it, the related code is: class Object: #this is a generic object: the player, a monster, an item, the stairs... #it's always represented by a character on screen. def __init__(self, x, y, char, color): self.x = x self.y = y self.char = char self.color = color def move(self, dx, dy): #move by the given amount, if the destination is not blocked #if

QGIS PyQt4 missing QString class

百般思念 提交于 2019-12-31 02:26:12
问题 i was trying to use a QString in the QGIS Python Console. from PyQt4.QtCore import QString but it says: ImportError: cannot import name QString In my Python IDLE it works fine, but i know that QGIS brings its own PyQt4. What could be the problem here? And could i solve it? import PyQt4.QtCore PyQt4.QtCore.QString() and from PyQt4 import QtCore QtCore.QString() dosen't works anyway. I was thinking about to copy the QtCore4.dll from my own PyQt4 installation to QGIS, but QGIS uses QtCore.prl

Python logging module having a formatter causes AttributeError

家住魔仙堡 提交于 2019-12-30 09:00:40
问题 I am writing a terminal application, which, after passing in -v option, gets, unsurprisingly, verbose. I want to have the output available in the terminal, for easy testing (it gets redirected to a log file when running as cron anyways). However, python logging module doesn't allow me to write out the messages with corresponding levels when using a formatter. (Formatter is copied directly from Python Logging Cookbok) This behavior is not limited to Python3 only. Python2.7 raises the same

Python: accessing DLL function using ctypes — access by function *name* fails

帅比萌擦擦* 提交于 2019-12-30 08:32:21
问题 myPythonClient (below) wants to invoke a ringBell function (loaded from a DLL using ctypes ). However, attempting to access ringBell via its name results in an AttributeError . Why? RingBell.h contains namespace MyNamespace { class MyClass { public: static __declspec(dllexport) int ringBell ( void ) ; } ; } RingBell.cpp contains #include <iostream> #include "RingBell.h" namespace MyNamespace { int __cdecl MyClass::ringBell ( void ) { std::cout << "\a" ; return 0 ; } } myPythonClient.py

Python: instance has no attribute

旧时模样 提交于 2019-12-29 05:46:05
问题 I have a problem with list within a class in python. Here's my code : class Residues: def setdata(self, name): self.name = name self.atoms = list() a = atom C = Residues() C.atoms.append(a) Something like this. I get an error saying: AttributeError: Residues instance has no attribute 'atoms' 回答1: Your class doesn't have a __init__() , so by the time it's instantiated, the attribute atoms is not present. You'd have to do C.setdata('something') so C.atoms becomes available. >>> C = Residues() >

AttributeError: module 'tensorflow' has no attribute 'python'

守給你的承諾、 提交于 2019-12-29 01:34:13
问题 >import tensorflow >import tensorflow.contrib >tensorflow.contrib module 'tensorflow.contrib' from 'D:\\ProgramData\\Anaconda3\\lib\\site-packages\\tensorflow\\contrib\\__init__.py' >import tensorflow.python >tensorflow.python Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: module 'tensorflow' has no attribute 'python' As you can see, I run this code in a cmd(win 10). Both "import tensorflow.contrib" and "import tensorflow.python" are OK, but commands