Scrapy: startproject only allows creating the project on an existing folder if the path is specified with an invalid module name

Created on 7 Jul 2020  Â·  3Comments  Â·  Source: scrapy/scrapy

(venv) [adrian@afonsox temporal]$ mkdir existing_folder
(venv) [adrian@afonsox temporal]$ scrapy startproject existing_folder
Error: Module 'existing_folder' already exists
(venv) [adrian@afonsox temporal]$ cd existing_folder && scrapy startproject existing_folder .
New Scrapy project 'existing_folder', using template directory '/home/adrian/temporal/venv/lib/python3.8/site-packages/scrapy/templates/project', created in:
    /home/adrian/temporal/existing_folder

You can start your first spider with:
    cd .
    scrapy genspider example example.com
bug

All 3 comments

On master branch, I am able to startproject on existing_folder successfully.


(venv) rajesh@Rajesh-PC:~$ mkdir existing_folder
(venv) rajesh@Rajesh-PC:~$ scrapy startproject existing_folder
New Scrapy project 'existing_folder', using template directory '/home/rajesh/scrapy/scrapy/templates/project', created in:
    /home/rajesh/existing_folder

You can start your first spider with:
    cd existing_folder
    scrapy genspider example example.com

Weird. I can reproduce it with master as well:

[adrian@afonsox scrapy]$ git fetch upstream && git checkout upstream/master -B master
…
[adrian@afonsox scrapy]$  cd /home/adrian/temporal
[adrian@afonsox temporal]$ . venv/bin/activate
(venv) [adrian@afonsox temporal]$ pip install -e /home/adrian/proxectos/scrapy/
…
(venv) [adrian@afonsox temporal]$ mkdir existing_folder
(venv) [adrian@afonsox temporal]$ scrapy startproject existing_folder
Error: Module 'existing_folder' already exists

Not sure if I am missing any steps ( as I am new to the project). In the master branch I did the following:

sujith@kdekidd0 î‚° ~/mystudy/scrapy î‚° virtualenv --python python3 .env
sujith@kdekidd0 î‚° ~/mystudy/scrapy î‚° source .env/bin/activate
(.env)  sujith@kdekidd0 î‚° ~/mystudy/scrapy î‚° pip install -e ~/test/scrapy
...
(.env)  sujith@kdekidd0 î‚° ~/mystudy/scrapy î‚° mkdir existing_project # no errors as this is a new directory
(.env)  sujith@kdekidd0 î‚° ~/mystudy/scrapy î‚° ./.env/bin/scrapy startproject existing_project
New Scrapy project 'existing_project', using template directory '/home/sujith/test/scrapy/scrapy/templates/project', created in:
    /home/sujith/mystudy/scrapy/existing_project

You can start your first spider with:
    cd existing_project
    scrapy genspider example example.com
(.env)  sujith@kdekidd0 î‚° ~/mystudy/scrapy î‚° cd existing_project
(.env)  ✘ sujith@kdekidd0  ~/mystudy/scrapy/existing_project  ../.env/bin/scrapy startproject existing_project
Error: Module 'existing_project' already exists
(.env)  ✘ sujith@kdekidd0  ~/mystudy/scrapy/existing_project 

Nothing pops off my head. For a newly created directory I am able to execute the startproject with the templates. But when I switch inside the existing directory and execute the same error mentioned in the issue is shown up. Kindly help me know if this is the problem or my findings are incorrect.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Shakyamuni177te picture Shakyamuni177te  Â·  3Comments

mohmad-null picture mohmad-null  Â·  4Comments

pawelmhm picture pawelmhm  Â·  3Comments

lopuhin picture lopuhin  Â·  3Comments

osmenia picture osmenia  Â·  3Comments