pythonpython-poetry

Python Poetry - Pointing to envs.TOML Which is Invalid, Rather Than pyproject.TOML


I've recently come back to a project which I'd left for a while. I am now attempting to add a new package via poetry add xxx but I receive an error -

Invalid TOML file C:/Users/username/AppData/Local/pypoetry/Cache/virtualenvs/envs.toml: Unexpected character: ']' at line 5 col 1

This is an actual TOML file that exists, but why is it pointing there all of a sudden? I have a pyproject.toml within my project root folder that has worked just fine up until now.

Is it possible to fix my Poetry install so that it recognises the pyproject.toml?

I should point out that I don't have a huge amount of experience with Poetry


Solution

  • I figured out what the issue was.

    I assumed that my Poetry environment was incorrectly looking at some random toml file stored locally. I didn't realise that envs.toml is a part of what Peotry utilises on its route to the actual project toml.

    my envs.toml file had somehow become corrupted and I just had to delete the offending section.

    It works perfectly now.