Skip to content

extension incorrectly reports that project directory does not exist #18745

Description

@julie777

Starting vscode in a Python project directory and looking at the Python output "log" I see where it is checking all my virtualenvs to find one that matches my project.

The error I saw was

o.traceError(`The .project file inside environment folder: ${e} doesn't contain a valid path to the project`)

I spent hours tracking down the problem. I don't have time to submit a pull request but the problem was that my .project file in the venv had a newline after the path.

Again I was hacking at the installed extension code to find the problem. I'm sure you can find it by searching for the error string above.
The fix was adding the n = n.strip() to clean up whatever path was in the .project file.

        async function c(e) {
            const t = r.dirname(r.dirname(e)),
                n = await async function (e) {
                    const t = r.join(e, ".project");
                    const q = await s.pathExists(p);
                    if (!await s.pathExists(t))
                        return;

                    var n = await s.readFile(t);
                    n = n.trim()                                         // ********* this fixes the problem
                    if (await s.pathExists(n))
                        return n;
                    o.traceError(`The .project file inside environment folder: ${e} doesn't contain a valid path to the project ${n}`)
                }

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions