【问题标题】:Replicate scrapy shell abilities in PyCharm python console在 PyCharm python 控制台中复制 scrapy shell 功能
【发布时间】:2017-10-19 15:20:36
【问题描述】:

如何在 PyCharm IPython 控制台中运行 scrapy shell 仿真?我想保留通过 Alt+Shift+E 从编辑器运行代码 sn-ps 的能力

【问题讨论】:

    标签: python scrapy pycharm


    【解决方案1】:

    我通过运行以下 python sn-p 使其工作:

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

    如果出现以下错误:

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

    那么你必须在 scrapy.cfg 中添加以下行:

    shell=python
    

    【讨论】:

    • 当我尝试这种方法时,我得到了MultipleInstanceErroripython(我的首选shell),即使使用shell=ipython 写在docs 中,但使用普通shell 它可以工作。
    • 另一个限制 - 不能在远程解释器中工作
    猜你喜欢
    • 2015-06-17
    • 1970-01-01
    • 2018-04-01
    • 2017-09-08
    • 1970-01-01
    • 2020-09-24
    • 2017-01-25
    • 2013-06-03
    • 2018-07-10
    相关资源
    最近更新 更多