You're missign parentheses for the "start" field:

class TrainingItem(Item):

    course = Field()
    desc = Field()
    start = Field()   # <--- here
    end = Field()
    school = Field
    trainId = Field()
    id = Field()






On Friday, January 23, 2015 at 12:49:04 PM UTC+1, [email protected] wrote:
>
>
> class TrainingItem(Item):
>
>     course = Field()
>     desc = Field()
>     start = Field
>     end = Field()
>     school = Field
>     trainId = Field()
>     id = Field()
>
> course = hxs.xpath(u'//h3[text()="XXXX"]/../h2[%s]/text()'%x).re(r'\S+')
>
>                 if course:
>                     
>                     train_item["start"] = course[0]
>                     
>                     train_item["end"] = course[2]
>                     
>                     train_item["course"] = course[3]
>
>
>
>
> 2015-01-23 19:32:14+0800 [zlzp] ERROR: Spider error processing <GET 
>         Traceback (most recent call last):
>           File "C:\python27\lib\site-packages\twisted\internet\base.py", 
> line 82
> 4, in runUntilCurrent
>             call.func(*call.args, **call.kw)
>           File "C:\python27\lib\site-packages\twisted\internet\task.py", 
> line 63
> 8, in _tick
>             taskObj._oneWorkUnit()
>           File "C:\python27\lib\site-packages\twisted\internet\task.py", 
> line 48
> 4, in _oneWorkUnit
>             result = next(self._iterator)
>           File 
> "C:\python27\lib\site-packages\scrapy-0.24.4-py2.7.egg\scrapy\uti
> ls\defer.py", line 57, in <genexpr>
>             work = (callable(elem, *args, **named) for elem in iterable)
>         --- <exception caught here> ---
>           File 
> "C:\python27\lib\site-packages\scrapy-0.24.4-py2.7.egg\scrapy\uti
> ls\defer.py", line 96, in iter_errback
>             yield next(it)
>           File 
> "C:\python27\lib\site-packages\scrapy-0.24.4-py2.7.egg\scrapy\con
> trib\spidermiddleware\offsite.py", line 26, in process_spider_output
>             for x in result:
>           File 
> "C:\python27\lib\site-packages\scrapy-0.24.4-py2.7.egg\scrapy\con
> trib\spidermiddleware\referer.py", line 22, in <genexpr>
>             return (_set_referer(r) for r in result or ())
>           File 
> "C:\python27\lib\site-packages\scrapy-0.24.4-py2.7.egg\scrapy\con
> trib\spidermiddleware\urllength.py", line 33, in <genexpr>
>             return (r for r in result or () if _filter(r))
>           File 
> "C:\python27\lib\site-packages\scrapy-0.24.4-py2.7.egg\scrapy\con
> trib\spidermiddleware\depth.py", line 50, in <genexpr>
>             return (r for r in result or () if _filter(r))
>           File 
> "C:\Users\Administrator\Desktop\ZLZP\ZLZP\zlzp_spiders\spiders_co
> okie.py", line 392, in parse_item
>             train_item["start"] = course[0]
>           File 
> "C:\python27\lib\site-packages\scrapy-0.24.4-py2.7.egg\scrapy\ite
> m.py", line 57, in __setitem__
>             (self.__class__.__name__, key))
>         exceptions.KeyError: 'TrainingItem does not support field: start'
>

-- 
You received this message because you are subscribed to the Google Groups 
"scrapy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/scrapy-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to