Skip to content

main() shouldn't crash if module was imported #12

@escalonn

Description

@escalonn

https://github.com/Ant0nidas/CK3-Playset-Preserver/blob/dcbf80eaccdc7c617d9c22d3069aa7394a14b923/CK3_PP.py#L65-L66

locate_ck3_directory relies on __file__, which works in typical use cases, including the only documented ways to use the tool, but it's bad practice for a few reasons

at minimum, the program shouldn't crash if someone does import CK3_PP; CK3_PP.main() (which leaves __file__ unset). currently it crashes in this case.

ideally we have more separation of concerns and the directory can be injected somehow in scenarios like the above.

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