Code Monkey home page Code Monkey logo

Comments (13)

monosans avatar monosans commented on May 29, 2024 3

I have a hunch that ENOENT is not caused by the Python executable, but by the cwd (current working directory) in which the startup occurs.

In https://github.com/monosans/djlint-vscode/releases/tag/v2023.8.0 I have improved the error output. Now instead of just an error message the entire error object is output, hopefully this will somehow give us a clue as to where to go next in solving this problem.

from djlint-vscode.

monosans avatar monosans commented on May 29, 2024 1

The issue was caused by using one of these extensions: Django Template Support or Twig Language. Both of these extensions create virtual documents that triggered djLint. In v2023.8.6, I made djLint only trigger on documents with the file or vscode-vfs URI scheme.

Now the issue should go away.

from djlint-vscode.

monosans avatar monosans commented on May 29, 2024

I was unable to reproduce the error with:

  • VSCode 1.80.1
  • Remote OS: Ubuntu 22.04
  • Python 3.11.4
  • djLint 1.32.1

How is my environment different from yours?

from djlint-vscode.

christopherpickering avatar christopherpickering commented on May 29, 2024

ENOENT normally means the path doesn't exist. Are you sure it is there and your user has access to it?

from djlint-vscode.

peterbaumert avatar peterbaumert commented on May 29, 2024

ENOENT normally means the path doesn't exist. Are you sure it is there and your user has access to it?

it exists and sometimes works, error only pops up like "half" of the time.

I was unable to reproduce the error with:

  • VSCode 1.80.1
  • Remote OS: Ubuntu 22.04
  • Python 3.11.4
  • djLint 1.32.1

How is my environment different from yours?

  • VSCode 1.80.1
  • Remote OS: Debian 11
  • Python 3.11.2 running in .venv
  • djLint 1.32.0

from djlint-vscode.

qxpf666 avatar qxpf666 commented on May 29, 2024

1 have the same problems.

from djlint-vscode.

qxpf666 avatar qxpf666 commented on May 29, 2024

Command failed with ENOENT: e:\BaiduNetdiskWorkspace\python\test\test_env\Scripts\python.exe -m djlint - --quiet --linter-output-format {filename}{line}{code}{message} spawn e:\BaiduNetdiskWorkspace\python\test\test_env\Scripts\python.exe ENOENT

from djlint-vscode.

bababash avatar bababash commented on May 29, 2024

I am having the same problem. The cwd definitely looks wrong but I don't know where to change it.
Using vscode in an ssh tunnel on my server.
Here is my error log:

2023-08-06 13:38:05.057 [error] {
	"errno": -2,
	"code": "ENOENT",
	"syscall": "spawn python",
	"path": "python",
	"spawnargs": [
		"-m",
		"djlint",
		"-",
		"--quiet",
		"--linter-output-format",
		"<filename>{filename}</filename><line>{line}</line><code>{code}</code><message>{message}</message>"
	],
	"originalMessage": "spawn python ENOENT",
	"shortMessage": "Command failed with ENOENT: python -m djlint - --quiet --linter-output-format <filename>{filename}</filename><line>{line}</line><code>{code}</code><message>{message}</message>\nspawn python ENOENT",
	"command": "python -m djlint - --quiet --linter-output-format <filename>{filename}</filename><line>{line}</line><code>{code}</code><message>{message}</message>",
	"escapedCommand": "python -m djlint - --quiet --linter-output-format \"<filename>{filename}</filename><line>{line}</line><code>{code}</code><message>{message}</message>\"",
	"stdout": "",
	"stderr": "",
	"cwd": "c:/Users/bababash/AppData/Roaming/Code/User",
	"failed": true,
	"timedOut": false,
	"isCanceled": false,
	"killed": false

from djlint-vscode.

monosans avatar monosans commented on May 29, 2024

I think I found the cause of the problem. I'll release a fix in half an hour.

from djlint-vscode.

monosans avatar monosans commented on May 29, 2024

With v2023.8.3, I've added a temporary fix for this problem. I'm not sure if it works, because I never managed to reproduce the issue.

I also added Output Channel logs like Unsupported scheme "{scheme}" for "{fsPath}". Cwd will not be set.. It would be nice if you could post them here, it would help a lot.

from djlint-vscode.

peterbaumert avatar peterbaumert commented on May 29, 2024

Hi thank you for takling this issue.

Here is my output ( only posting one but its always same besides different filenames):

2023-08-07 12:18:09.289 [warning] Unsupported scheme "dj-embedded-content" for "/file%3A%2F%2F%2Fvar%2Fwww%2Fhtml%2FMYDIR%2Fito%2Fservices%2Ftemplates%2Fservices%2Fvirtual_machine%2Fdetail.html/0.7057242894984939.html". Cwd will not be set.

from djlint-vscode.

monosans avatar monosans commented on May 29, 2024

@peterbaumert, please close the issue if everything works now.

from djlint-vscode.

peterbaumert avatar peterbaumert commented on May 29, 2024

All seems to be working now. Thank you for the fix!

from djlint-vscode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.