Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Remove unneeded try-except

Adrián Chaves1cc8d5829fc1
diff --git a/scrapy/commands/startproject.py b/scrapy/commands/startproject.py
index 35b58090c..82ccda35e 100644
--- a/scrapy/commands/startproject.py
+++ b/scrapy/commands/startproject.py
@@ -42,10 +42,7 @@ class Command(ScrapyCommand):
def _is_valid_name(self, project_name):
def _module_exists(module_name):
- try:
- spec = find_spec(module_name)
- except ModuleNotFoundError:
- return False
+ spec = find_spec(module_name)
return spec is not None and spec.loader is not None
if not re.search(r'^[_a-zA-Z]\w*$', project_name):