attributeerror

Cannot execute custom Selenium assert function from user-extensions.js file, when running Python RC against Selenium server

浪尽此生 提交于 2019-12-13 08:41:01
问题 I'm trying to export a Selenium script to Python from the Selenium IDE. I am using a few user-extension.js functions though (which are working in Selenium IDE). After exporting to Python, the generated script looks like this: from selenium import selenium import unittest, time, re class new_selenium_test(unittest.TestCase): def setUp(self): self.verificationErrors = [] self.selenium = selenium("localhost", 4444, "*chrome", "http://localhost/") self.selenium.start() def test_selenium_assert

Cython AttributeError: 'module' object has no attribute 'declare'

丶灬走出姿态 提交于 2019-12-13 07:09:06
问题 Compiling .pyx files was working fine but suddenly it started raising error when I type: python setup.py build_ext --inplace I get the error: c:\Python27\cython\helloworld>python setup.py build_ext --inplace running build_ext cythoning hello.pyx to hello.c Traceback (most recent call last): File "setup.py", line 8, in <module> ext_modules = [Extension("hello", ["hello.pyx"])] File "C:\Python27\lib\distutils\core.py", line 152, in setup dist.run_commands() File "C:\Python27\lib\distutils\dist

“AttributeError: '_NotSet' object has no attribute 'lower'” when a PRAW python file is converted to an exe using Pyinstaller

扶醉桌前 提交于 2019-12-13 03:56:01
问题 As the title says. When I execute the converted python file (the .exe) I get the following output: Traceback (most recent call last): File "background.py", line 10, in <module> File "site-packages\praw\reddit.py", line 129, in __init__ File "site-packages\praw\config.py", line 72, in __init__ File "site-packages\praw\config.py", line 98, in _initialize_attributes File "site-packages\praw\config.py", line 31, in _config_boolean AttributeError: '_NotSet' object has no attribute 'lower' [1692]

Message instance has no attribute 'is_multipart'

最后都变了- 提交于 2019-12-13 03:12:37
问题 I am trying to write a script that gets me the contents of all the Mails in ~/Maildir . So I basically copypasted code from this question. Here is the full content of mailbox.py : import mailbox maildir = mailbox.Maildir("~/Maildir"); for message in maildir: print message["subject"] if message.is_multipart(): print "ok" It does print the subject of the first message, but instead of printing "ok" then, it dies stating AttributeError: Message instance has no attribute 'is_multipart' What did I

Origin of AttributeError: object has no attribute 'cos'

社会主义新天地 提交于 2019-12-13 03:06:25
问题 I came upon this post : Sympy to numpy causes the AttributeError: 'Symbol' object has no attribute 'cos', and would like to understand a bit more the origin of the exception. To be more precise, Eric answered : "This type of error occurs when you call np.cos(a_symbol), which apparently translates under-the-hood in numpy to a_symbol.cos()." I would like to understand how/where this behaviour origins from : how does np.cos(x) can be translated under the hood into x.cos() ? I tried to reproduce

Python pandas dataframe pivot only works with pivot_table() but not with set_index() and unstack()

对着背影说爱祢 提交于 2019-12-12 13:03:11
问题 I am trying to pivot following type of sample data in Pandas dataframe in Python. I came across couple of other stackoverflow answers that discussed how to do the pivot: pivot_table No numeric types to aggregate However, when I use pivot_table() , I am able to pivot the data. But when I use set_index() and unstack() , I get following error: AttributeError: 'NoneType' object has no attribute 'unstack' Sample Data: id responseTime label answers ABC 2018-06-24 Category_1 [3] ABC 2018-06-24

AttributeError: LinearRegression object has no attribute 'coef_'

时光毁灭记忆、已成空白 提交于 2019-12-12 10:31:44
问题 I've been attempting to fit this data by a Linear Regression, following a tutorial on bigdataexaminer. Everything was working fine up until this point. I imported LinearRegression from sklearn, and printed the number of coefficients just fine. This was the code before I attempted to grab the coefficients from the console. import numpy as np import pandas as pd import scipy.stats as stats import matplotlib.pyplot as plt import sklearn from sklearn.datasets import load_boston from sklearn

Python / Numpy AttributeError: 'float' object has no attribute 'sin'

孤街浪徒 提交于 2019-12-12 09:48:46
问题 I'm going to post this here because it's quite a chestnut and caused me some head-scratching. It's arguably a duplicate of this question posted four years ago but I'll post it again in case someone has the specific pandas-numpy incompatibility that I have encountered here. Or maybe someone will come up with a better answer. Code snippet: #import pdb; pdb.set_trace() # TODO: This raises AttributeError: 'float' object has no attribute 'sin' xr = xw + L*np.sin(θr) Output: Traceback (most recent

Python Selenium 'WebDriver' object has no attribute error

纵饮孤独 提交于 2019-12-12 08:06:10
问题 I'm trying to scrape some javascript-generated content from a Chinese-language website. I'm using Selenium (and Python) since I can't scrape the javascript content directly. # -*- coding: utf-8 -*- from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.selenium import selenium import time import urllib2 import httplib import urllib import re import base64 browser = webdriver.Firefox() # Get local session of firefox browser.get("http://www...") # Load page

python error : 'str' object has no attribute 'upper()'

陌路散爱 提交于 2019-12-12 07:07:20
问题 I'm discovering possibilities of string formatting with .format( ) method in Python 3 but i raised an error that i do not understand. So, why the following line is ok [wich let me think that "0" can be used exactly like the argument passed to format()]: s = 'First letter of {0} is {0[0]}'.format("hello") #gives as expected: 'First letter of hello is h' but not this one [applying a method or a function to 0 in {0} doesn't work?]: s = '{0} becomes {0.upper()} with .upper() method'.format("hello