Note that there are some explanatory texts on larger screens.

plurals
  1. POScrapy issue with csv output
    primarykey
    data
    text
    <p>Here is my spider:</p> <pre><code> from scrapy.contrib.spiders import CrawlSpider,Rule from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor from scrapy.selector import HtmlXPathSelector from vrisko.items import VriskoItem from scrapy.http import Request class vriskoSpider(CrawlSpider): name = 'vrisko' allowed_domains = ['vrisko.gr'] start_urls = ['http://www.vrisko.gr/search/%CE%B3%CE%B9%CE%B1%CF%84%CF%81%CE%BF%CF%82/%CE%BA%CE%BF%CF%81%CE%B4%CE%B5%CE%BB%CE%B9%CE%BF'] rules = (Rule(SgmlLinkExtractor(allow=('\?page=\d')),'parse_start_url',follow=True),) def parse_start_url(self, response): hxs = HtmlXPathSelector(response) subpages = hxs.select('//a[@class="detailsHyper_class"]/@href').extract() ep = hxs.select('//a[@itemprop="name"]/text()').extract() ad = hxs.select('//div[@class="results_address_class"]/text()').extract() for eponimia,address,subpage in zip(ep,ad,subpages): vriskoit = VriskoItem() vriskoit['eponimia'] = eponimia vriskoit['address'] = address request = Request(subpage,callback = self.subPage) request.meta['vriskoit'] = vriskoit yield request def subPage(self,response): vriskoit = response.meta['vriskoit'] hxs = HtmlXPathSelector(response) vriskoit['category'] = hxs.select('//div[@class="category_class"]/span/text()').extract() yield vriskoit </code></pre> <p>and here is my pipiline:</p> <pre><code> import csv class myExporter(object): def __init__(self): self.brandCategoryCsv = csv.writer(open('brandCategoryTable.csv', 'wb')) self.brandCategoryCsv.writerow(['eponimia', 'address','category']) def process_item(self, item, spider): for e,a,c in zip(item['eponimia'],item['address'],item['category']): self.brandCategoryCsv.writerow([e.encode('utf-8'), a.encode('utf-8'), c.encode('utf-8')]) return item </code></pre> <p>my problem is that for both the first 2 fields (eponimia,address), only the first character is written to the output csv file and i cant find why. </p> <p>Any help would be much appreciated, i am out of ideas.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload