pkl-python icon indicating copy to clipboard operation
pkl-python copied to clipboard

Infinity loop when there is no PklProject file

Open almogtavor opened this issue 1 year ago • 0 comments

Some more instructions for basic usage and maybe a simple PklProject file addition to the README.md would be great. In cases where I don't have a PklProject file, there's an infinity loop at the __init__.py file in cases where there's no such file since the loop expects a Linux fs:

def _search_project_dir(module_path: str) -> str:
    cur_path = Path(module_path).parent.absolute()
    while not (cur_path / "PklProject").exists():
        cur_path = cur_path.parent
        if str(cur_path) == "/":
            break

    if str(cur_path) == "/":
        cur_path = Path(module_path).parent
    return str(cur_path.absolute())

Changing this line if str(cur_path) == "/": to something like if str(cur_path) == "/" or str(cur_path) == "'C:\\'": would help, but won't work for cases of different than C drivers are being used, so there's must be a better way to handle this.

almogtavor avatar Aug 18 '24 23:08 almogtavor