I am trying to make an exe file with -py2exe Here is my code:
import requests
from bs4 import BeautifulSoup
import csv
def get_html(url):
r = requests.get(url)
return r.text
url='http://rcrealty.ru/catalog/residential/office'
html=get_html(url)
soup=BeautifulSoup(html, 'lxml')
mydivs = soup.findAll('div',class_="properties-list-block")
pages=soup.findAll('a',class_='col-xs-12 col-sm-6 col-md-3 predloj')
z=[]
for page in pages :
z.append(page.get('href'))
pages=soup.find('a',class_='col-xs-12 col-sm-6 col-md-3 predloj')
pages=soup.findAll('a',class_='col-xs-12 col-sm-6 col-md-3 predloj')
z=[]
for page in pages :
z.append(page.get('href'))
urls=[]
for i in z:
ur='http://rcrealty.ru'+str(i)
urls.append(ur)
titles = soup.findAll('h2',class_="title")
t=[]
for i in titles:
t.append(i)
texts=[]
for i in urls:
z=get_html(i)
soup=BeautifulSoup(z, 'lxml')
r=soup.findAll('p')
texts.append(r[0])
da={'titles': t,'links' :urls,'texts':texts}
with open('C:\\1\\2\\1.txt','wb') as f:
f.write(u'\ufeff'.encode('utf8')) # writes "byte order mark" UTF-8 signature
writer=csv.writer(f)
for i in da:
for rows in da[i]:
writer.writerow([rows.encode('utf8')])
and this is my setup.py file - from distutils.core import setup import py2exe
setup(
windows=[{"script":"parser_ned.py"}],
options={"py2exe": {"includes":["bs4","requests","csv","lxml"]}},
zipfile=None
)
i get the following error in log file after compilation:
bs4.FeatureNotFound: Couldn't find a tree builder: lxml
i run in cmd n python setup.py py2exe
i have no idea how to fixed it. The problem is connected with lxml , but i had add it to my setup modules. Please help