El Ruso
El Ruso

Reputation: 15881

Replicate scrapy shell abilities in PyCharm python console

How can I run the scrapy shell emulation inside PyCharm IPython console? I want to keep the ability to run snippets of code from editor by Alt+Shift+E

Upvotes: 5

Views: 847

Answers (1)

Samuel
Samuel

Reputation: 1374

I got it working by running the following python snippet:

from scrapy.cmdline import execute
import sys
sys.argv = ['scrapy', 'shell', 'http://scrapy.org']
execute()

If you get the following error:

MultipleInstanceError: Multiple incompatible subclass instances of InteractiveShellEmbed are being created.

then you have to add to the scrapy.cfg the following line:

shell=python

Upvotes: 6

Related Questions