1
Vote

Unexpected search path for run standalone script?

description

If I have a project with the following structure:
/run.py
/config.py
/scripts/db_create.py
and from db_create.py:
from config import *
Right-click on db_create.py and start with or without debugging.

Result: The import fails.

I then add a search path to my project: '.'

Do it again and it works.

Having the scripts folder be the working folder makes sense to me when I launch the 'standalone script'. It means if I wanted this to work without adding the '.' to my project search path, then it would have to automatically add the project home directory to the search path when running a standalone script. Would that be expected/unexpected?

It just feels strange to have a '.' search path in my project.

comments