Hi Tim,

Your myspider.py file defines a Spider subclass, and calling `python 
myspider.py` will not execute much except reading the class definition.

You need to run the spider using `scrapy runspider myspider.py`
which is the last line of the example on https://scrapy.org

You can read more about "runspider" 
at https://doc.scrapy.org/en/latest/topics/commands.html#std:command-runspider

Best,
Paul.

On Wednesday, September 28, 2016 at 3:16:53 PM UTC+2, Tim Fitzhardinge 
wrote:
>
>
> favorite 
> <http://stackoverflow.com/questions/39687170/running-scrapy-tutorial-in-conda#>
>
> Hi
>
> I'm new to Python and running python scripts.
>
> I am using Anaconda
>
> I wanted to run the scrapy tutorial on the home page of the website
>
> https://scrapy.org
>
> $ pip install scrapy
> $ cat > myspider.py <<EOFimport scrapy
> class BlogSpider(scrapy.Spider):
>     name = 'blogspider'
>     start_urls = ['https://blog.scrapinghub.com']
>
>     def parse(self, response):
>         for title in response.css('h2.entry-title'):
>             yield {'title': title.css('a ::text').extract_first()}
>
>         next_page = response.css('div.prev-post > a        
> ::attr(href)').extract_first()
>         if next_page:
>             yield scrapy.Request(response.urljoin(next_page),      
> callback=self.parse)
> $ EOF
>
> scrapy runspider myspider.py
>
> I also tried replacing the first line with:
>
> conda install -c scrapinghub scrapy=1.1.2
>
> I saved a myspider.py on my user c drive folder. I copied the whole code 
> however when I tried to run the script using python myspider.py in the 
> anaconda prompt it does not work and returns with a syntax error.
>
> What is the syntax of the tutorial that I should use for running in 
> anaconda.
>
> Thanks
>

-- 
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 https://groups.google.com/group/scrapy-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to