Skip to content
Myr

Explained why os.getcwd is used for path finding

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent 08bf538 · Browse files · 1 file+3 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−0 removed

  • other:+3 added−0 removed

1 file+3 added−0 removed

modified:flask/helpers.py+3 added
482 unmodified lines
483 try:484 directory = os.path.dirname(sys.modules[import_name].__file__)485 return os.path.abspath(directory)486 except AttributeError:487 # this is necessary in case we are running from the interactive488 # python shell. It will never be used for production code however489 return os.getcwd()490491492def find_package(import_name):
7 unmodified lines
500 __import__(import_name)501 root_mod = sys.modules[import_name.split('.')[0]]502 package_path = getattr(root_mod, '__file__', None)503 if package_path is None:504 # support for the interactive python shell505 package_path = os.getcwd()506 else:507 package_path = os.path.abspath(os.path.dirname(package_path))508 if hasattr(root_mod, '__path__'):
141 unmodified lines