首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >风车AttributeError:“模块”对象没有属性“设置”

风车AttributeError:“模块”对象没有属性“设置”
EN

Stack Overflow用户
提问于 2014-01-28 03:54:51
回答 1查看 797关注 0票数 1

这是回溯:

代码语言:javascript
复制
File "./test2.py", line 44, in test_scrape
    client = WindmillTestClient(__name__)
File "/usr/local/lib/python2.7/dist-packages/windmill-1.6-py2.7.egg/windmill/authoring/__init__.py", line 142, in __init__
method_proxy = windmill.tools.make_jsonrpc_client()
File "/usr/local/lib/python2.7/dist-packages/windmill-1.6-py2.7.egg/windmill/tools/__init__.py", line 35, in make_jsonrpc_client
url = urlparse(windmill.settings['TEST_URL'])
AttributeError: 'module' object has no attribute 'settings'

下面是我的测试python文件(test.py):

代码语言:javascript
复制
#!/usr/bin/env python
# Generated by the windmill services transformer
from windmill.authoring import WindmillTestClient
from bs4 import BeautifulSoup

import re, urlparse
from copy import copy



def get_table_info(client):
    """
    Parse HTML page and extract featured image name and link
    """
    # Get Javascript updated HTML page
    client.waits.forElement(xpath=u"//table[@id='trades']",
                        timeout=40000)
    response = client.commands.getPageText()
    assert response['status']
    assert response['result']

    # Create soup from HTML page and get desired information

    soup = BeautifulSoup(response['result'])


    table_info = soup.find("title")
    return table_inf        



def test_scrape():
    client = WindmillTestClient(__name__)
    client.open(url='http://www.google.com')


test_scrape_()
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-01-28 04:02:07

您没有执行所需的必要设置:

代码语言:javascript
复制
from windmill.authoring import setup_module, WindmillTestClient
from windmill.conf import global_settings
import sys

global_settings.START_FIREFOX = True # This makes it use Firefox
setup_module(sys.modules[__name__])

在尝试实例化WindmillTestClient之前,应该会发生这种情况。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21396510

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档