2014-01-28 3 views
1

Вот отслеживающий:Мельница AttributeError: 'модуль' объект имеет нет атрибута 'Настройки'

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' 

Вот мой тест питон файл (test.py):

#!/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_() 

ответ

1

Вы не делать некоторые необходимые настройки не требуется:

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.

Смежные вопросы