Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Gallaecio opened this issue Jul 7, 2020 · 3 comments · Fixed by #4676
Labels

Comments

@Gallaecio
Copy link
Member

(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
@Gallaecio Gallaecio added the bug label Jul 7, 2020
@rajat315315
Copy link

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

@Gallaecio
Copy link
Member Author

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

@elacuesta elacuesta added this to the v2.2.1 milestone Jul 8, 2020
@sharidas
Copy link

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.

Gallaecio added a commit to Gallaecio/scrapy that referenced this issue Jul 13, 2020
@kmike kmike removed this from the v2.2.1 milestone Jul 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants