最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

venv - abjad.show() issues "FileNotFoundError: [WinError 2] The system cannot find the file specified" in Pyth

programmeradmin9浏览0评论

Here's a basic, simple 'abjad' code that one can find in any 'abjad' documentation:

import abjad
n = abjad.Note("c'4")
abjad.show(n)

And here's the full traceback produced by the above code:

Traceback (most recent call last):
  File "R:\W\y.py", line 122, in <module>
    abjad.show(n)
  File "R:\W\venv\Lib\site-packages\abjad\io.py", line 672, in show
    result = illustrator()
             ^^^^^^^^^^^^^
  File "R:\W\venv\Lib\site-packages\abjad\io.py", line 75, in __call__
    string = self.string or self.get_string()
                            ^^^^^^^^^^^^^^^^^
  File "R:\W\venv\Lib\site-packages\abjad\io.py", line 152, in get_string
    return lilypond_file._get_lilypond_format()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "R:\W\venv\Lib\site-packages\abjad\lilypondfile.py", line 474, in _get_lilypond_format
    string = configuration.get_lilypond_version_string()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "R:\W\venv\Lib\site-packages\abjad\configuration.py", line 388, in get_lilypond_version_string
    proc = subprocess.run(command, stdout=subprocess.PIPE)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\Python3.12\Lib\subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\Python3.12\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "G:\Python3.12\Lib\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified

Note: I debugged 'subprocess.py' and saw that 'executable' was None, but I couldn't find what it was expected to be.

I have installed abjad in a virtual environment, using both Python 3.10 and Python 3.12. And I have tried with both abjad versions, 3.19 & 3.21. Same story.

I have installed hundreds of Python packages ... I can't remember this case evere having occurred.

Any idea why's this happening?

Here's a basic, simple 'abjad' code that one can find in any 'abjad' documentation:

import abjad
n = abjad.Note("c'4")
abjad.show(n)

And here's the full traceback produced by the above code:

Traceback (most recent call last):
  File "R:\W\y.py", line 122, in <module>
    abjad.show(n)
  File "R:\W\venv\Lib\site-packages\abjad\io.py", line 672, in show
    result = illustrator()
             ^^^^^^^^^^^^^
  File "R:\W\venv\Lib\site-packages\abjad\io.py", line 75, in __call__
    string = self.string or self.get_string()
                            ^^^^^^^^^^^^^^^^^
  File "R:\W\venv\Lib\site-packages\abjad\io.py", line 152, in get_string
    return lilypond_file._get_lilypond_format()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "R:\W\venv\Lib\site-packages\abjad\lilypondfile.py", line 474, in _get_lilypond_format
    string = configuration.get_lilypond_version_string()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "R:\W\venv\Lib\site-packages\abjad\configuration.py", line 388, in get_lilypond_version_string
    proc = subprocess.run(command, stdout=subprocess.PIPE)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\Python3.12\Lib\subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\Python3.12\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "G:\Python3.12\Lib\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified

Note: I debugged 'subprocess.py' and saw that 'executable' was None, but I couldn't find what it was expected to be.

I have installed abjad in a virtual environment, using both Python 3.10 and Python 3.12. And I have tried with both abjad versions, 3.19 & 3.21. Same story.

I have installed hundreds of Python packages ... I can't remember this case evere having occurred.

Any idea why's this happening?

Share Improve this question asked Feb 5 at 12:34 ApostolosApostolos 3,44527 silver badges35 bronze badges 0
Add a comment  | 

1 Answer 1

Reset to default 2

Looking at the source of "...\abjad\configuration.py", line 388 (as pointed to by the error message), we have the following lines:

command = ["lilypond", "--version"]
proc = subprocess.run(command, stdout=subprocess.PIPE)

So the process is trying to run the command "lilypond --version", and failing because Windows cannot find an executable file or command script with that name. You should check where that command is installed and ensure that its full path is added to your PATH environment variable.

发布评论

评论列表(0)

  1. 暂无评论