move to after check

This commit is contained in:
Matthew Donoughe 2022-10-20 20:18:06 -04:00
parent 12a26755ae
commit 607eece72a
No known key found for this signature in database
GPG Key ID: 838812402CA8C19D
1 changed files with 1 additions and 1 deletions

View File

@ -12,9 +12,9 @@ from scrapy.commands import BaseRunSpiderCommand
def _import_file(filepath: Union[str, PathLike]) -> ModuleType:
abspath = Path(filepath).resolve()
dirname = str(abspath.parent)
if abspath.suffix not in ('.py', '.pyw'):
raise ValueError(f"Not a Python source file: {abspath}")
dirname = str(abspath.parent)
if dirname:
sys.path = [dirname] + sys.path
try: