Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 748
El Ruso Avatar asked Jun 22 '17 14:06

El Ruso


1 Answers

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
like image 135
Samuel Avatar answered Sep 29 '22 12:09

Samuel