Adam
Adam

Reputation: 415

Creating Python scrapy project yields: File "<stdin>", line 1 error

Windows 10, Command Line Terminal, Python 3.6.3 |Anaconda, Inc.| (default, Oct 15 2017, 03:27:45) [MSC v.1900 64 bit (AMD64)] on win32

New to Python & following tutorial instructions here: https://docs.scrapy.org/en/latest/intro/tutorial.html

Steps:

  1. Downloaded Anaconda
  2. Installed scrapy package through Anaconda Navigator
  3. Opened terminal
  4. cd c:\Anaconda
  5. python
  6. scrapy startproject tutorial

Yields this error:

File "<stdin>", line 1
scrapy startproject tutorial
Syntax Invalid Syntax

See screenshot: https://www.dropbox.com/s/17d3r1hzt02pp2k/Screenshot%202017-11-08%2013.41.06.png?dl=0

I've run globals() to see that Scrapy appears to be running correctly.

I've also try running this command from c:\Anaconda directory.

python scrapy startproject tutorial

Which yielded this error:

python.exe: can't find '__main__' module in 'scrapy'

There may also be an issue with Anaconda & Scrapy (Cannot Set Up a Scrapy Project) though, to my knowledge, I installed correctly using the recommended method from scrapy.org.

Upvotes: 0

Views: 1151

Answers (1)

ilovecomputer
ilovecomputer

Reputation: 4708

When you run scrapy startproject tutorial from terminal, the scrapy executable file will be executed. So first, find out where the scrapy executable file is located, change to that directory(c:\Anaconda directory for example) and run the command:

scrapy startproject tutorial

or run scrapy from a absolute path like this:

/Library/Frameworks/Python.framework/Versions/3.6/bin/scrapy startproject tutorial

or like this:

c:/path/scrapy.exe scrapy startproject tutorial

Upvotes: 1

Related Questions