Remove unneeded try-except

Exceptions only happen when find_spec gets a 2nd parameter.
This commit is contained in:
Adrián Chaves 2020-08-06 13:52:47 +02:00
parent 544c1f6e39
commit 1cc8d5829f
1 changed files with 1 additions and 4 deletions

View File

@ -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):