Skip to content

Add current directory to default module load path? #3

Closed
@jayfoad

Description

@jayfoad

When you import a module, Python looks for it in the directories listed in sys.path (loads more info here). The first thing on sys.path is the directory containing the input script, or '' (i.e. the current working directory) if there was no input script, i.e. for normal interactive use, so you can import stuff straight from the cwd.

I reckon that folks using pynapl to call Python from APL would see it as interactive use, and would like to be able to import stuff from the cwd. Unfortunately that doesn't work at the moment because under the covers Python is started with an input script, so sys.path does not start with ''.

I reckon we should explicitly add '' to sys.path at startup, so that import works as users expect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementFor non-critical additional improvements.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions