Skip to content

Document that -I picks up on dirname(file) automatically #61

@sirosen

Description

@sirosen

I was trying to figure out how much I needed to script/wrap to have cog to grab a ./_cog_helpers.py file from the directory where a file lives with -I. It then struck me that maybe . should often be added to the path, so I figured either it was a feature already or I should suggest a flag for it.

Looks like it already is the behavior!

cog/cogapp/cogapp.py

Lines 674 to 676 in 86d8f30

# Since we know where the input file came from,
# push its directory onto the include path.
self.add_to_include_path([os.path.dirname(fname)])

I found my way, but I think the docs should call this out explicitly. I'm happy to post a PR. What do you think of adding a one-sentence note to https://cog.readthedocs.io/en/latest/running.html#miscellaneous ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions