4
votes

ENVIRONMENT Windows 7 (64) Python 2.7.3 (32) pip install scrapy

I have my paths set C:\Python27;C:\Python27\Scripts

After installing all dependency libs (lxml, openssl, pywin32, twisted, zope) i no longer get errors when I pip install scrapy so everything seems to be installed as needed

PROBLEM:

if i try start from python dir

C:\Python27>  scrapy startproject new
'scrapy' is not recgonized as an internal command or external...

if i try start from scripts dir

C:\Python27\Scripts>  scrapy startproject new
'python' is not recgonized as an internal command or external...

if i try start from folder i want make new scrape

C:\Python27\new>  scrapy startproject new
'scrapy' is not recgonized as an internal command or external...

The path is certainly set right and working properly, otherwise I wouldnt be able to use pip install, virtualenv, etc. Scrapy startproject is only python action I have this problem with

Please help what could stop it from seeing "scrapy startproject" command?

UPDATE:

tried reinstall python273 (32) for "just me" current user, not all users and now have made progress. now i can call scrapy command but ONLY if i explicitly state full path WHILE im in python27 directory. see below

this does not work

C:\> C:\Python27\Scripts\scrapy version
'python' is not recognized as an internal or external command,
operable program or batch file.

this works!

C:\> cd python27

C:\Python27> C:\Python27\Scripts\scrapy version
Scrapy 0.16.3

this does not work

C:\Python27> cd scripts

C:\Python27\Scripts> scrapy version
'python' is not recognized as an internal or external command,
operable program or batch file.

What would cause the need for scrapy to work fine using full path only when in python directory?

finally able to call "scrapy startproject" command, which worked and generated files, but don't think I will ever be able to call "scrapy crawl" command until I get this figured out

2
At the risk of asking a stupid question, are "scrapy" and "scrapy.bat" both present in C:\Python27\Scripts? If so, have you tried running scrapy with an explicit path eg: "C:\Python27\Scripts\scrapy startproject new". Also, what is the result of running the command "pip freeze"?Talvalin
yes both scrapy and scrapy.bat exist in scripts folder and using explicit path attempt no luck - 'python' not recognized C:\Python27\Scripts> C:\Python27\Scripts\scrapy startproject new 'python' is not recognized as an internal or external command,hackg
Try this link and install the latest version of each library for Python 2.7. Note that I have the 64-bit installation of Python 2.7.3 and so didn't need to fiddle with the registry: github.com/scrapy/scrapy/wiki/…Talvalin
none that helped. registry changes the issue still resides. all my libs are def up to date. i tried reinstall python2.7.3 and had partial success. See my update - still cant figure out why cant call scrapy command straight out. maybe need to set "scrapy" path variable?hackg
If you type path at the command line, compare it with your system path and user path environment variables. Occasionally (no idea why), my user path gets ignored and so I get the python error above.Talvalin

2 Answers

2
votes

Adding to this solution, make sure that the environment variables have no spaces in them. This just fixed the issue for me.

e.g. C:\Python27;C:\Python27\Scripts NOT C:\Python27; C:\Python27\Scripts

0
votes

rookie mistake - there was after all a problem with my PATH

i saw lot of code examples to set path as set PATH %PATH% .... and thought this PATH was placeholder for scenario. I was typing Python there

FIX - I edited path to include...

for system environment variable:

Variable name: Path 
Variable value: C:\Python27;C:\Python27\Scripts

restarted command prompt and now it all works, scrapy command works as expected and can be called outside main python folder without full directory path to the scrapy file

THANKS Talvalin, I finally found this via your last suggestion to type path and see what it was actually reading