[Python] Spider fails to run when the output format is passed

Discussão em 'Python' iniciado por Stack, Janeiro 27, 2025.

  1. Stack

    Stack Membro Participativo

    I made a code from a tutorial, it's practically the same. The guy runs it from the terminal with a .csv file as output. When I run it, it appears many options for running the file but it doesn't run and doesn't throw any errors. I run it like this:

    (.venv) PS C:\Users\dodge\PycharmProjects\Scraper> scrapy runspider merclibre.py -o mercadolibre.csv -t csv


    And the output is this:

    2024-12-25 19:47:05 [scrapy.utils.log] INFO: Scrapy 2.12.0 started (bot: scrapybot)
    2024-12-25 19:47:05 [scrapy.utils.log] INFO: Versions: lxml 5.3.0.0,
    libxml2 2.11.7
    , cssselect 1.2.0, parsel 1.9.1, w3lib 2.2.1, Twisted 24.11.0, Python
    3.12.6 (tags/
    v3.12.6:a4a2d2b, Sep 6 2024, 20:11:23) [MSC v.1940 64 bit (AMD64)],
    pyOpenSSL 24.3
    .0 (OpenSSL 3.4.0 22 Oct 2024), cryptography 44.0.0, Platform Windows-
    11-10.0.22631-SP0
    Usage
    =====
    scrapy runspider [options] <spider_file>

    Run the spider defined in the given file

    Options
    =======
    -h, --help show this help message and exit
    -a NAME=VALUE set spider argument (may be repeated)
    -o FILE, --output FILE
    append scraped items to the end of FILE (use - for
    stdout), to define format set a colon at the end of
    the
    output URI (i.e. -o FILE:FORMAT)
    -O FILE, --overwrite-output FILE
    dump scraped items into FILE, overwriting any
    existing
    file, to define format set a colon at the end of
    the
    output URI (i.e. -O FILE:FORMAT)

    Global Options
    --------------
    --logfile FILE log file. if omitted stderr will be used
    -L LEVEL, --loglevel LEVEL
    log level (default: DEBUG)
    --nolog disable logging completely
    --profile FILE write python cProfile stats to FILE
    --pidfile FILE write process ID to FILE
    -s NAME=VALUE, --set NAME=VALUE
    set/override setting (may be repeated)
    --pdb enable pdb on failure

    Continue reading...

Compartilhe esta Página