dr-doc-search icon indicating copy to clipboard operation
dr-doc-search copied to clipboard

Windows machine 'C:\Program' not recognized as an internal or external command,

Open catbears opened this issue 1 year ago • 0 comments

What happend: I installed in a new environment, set up the path like described. Except here I have a more recent version of image magic, so the IMCONV looks like this: %PROGRAMFILES%\ImageMagick-7.1.0-Q16-HDRI\

Windows finds magick as a command, but when I do dr-doc-search --train -i "pdfs\my_pdf.pdf" --embedding huggingface

There is this error.

'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\user\code_folder\dr_doc_test\venv\Scripts\dr-doc-search.exe\__main__.py", line 7, in <
module>
  File "C:\Users\user\code_folder\dr_doc_test\venv\Lib\site-packages\doc_search\app.py", line 68, in ma
in
    run_workflow(context, training_workflow_steps())
  File "C:\Users\user\code_folder\dr_doc_test\venv\Lib\site-packages\py_executable_checklist\workflow.p
y", line 36, in run_workflow
    __run_step(step, context)
  File "C:\Users\user\code_folder\dr_doc_test\venv\Lib\site-packages\py_executable_checklist\workflow.p
y", line 29, in __run_step
    returned_context = step_instance.execute() or {}
                       ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\code_folder\dr_doc_test\venv\Lib\site-packages\doc_search\workflow\__init__.py",
line 142, in execute
    run_command(convert_command)
  File "C:\Users\user\code_folder\dr_doc_test\venv\Lib\site-packages\py_executable_checklist\workflow.p
y", line 9, in run_command
    return subprocess.check_output(command, shell=True).decode("utf-8")  # nosemgrep
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'C:\Program Files\ImageMagick-7.1.0-Q16-HDRI\magick convert -density 150 -
trim -background white -alpha remove -quality 100 -sharpen 0x1.0 C:\Users\user\OutputDir\dr-doc-search\my_pdf\my_pdf.pdf[1] -quali
ty 100 C:\Users\user\OutputDir\dr-doc-search\my_pdf\images\outpu
t-1.png' returned non-zero exit status 1.

It seems to me, that this is the problem: 'C:\Program' is not recognized as an internal or external command, operable program or batch file.

In Windows the folder is called Program Files and the space in the name is a reliable source of errors in my scripts. I don't really understand where it comes from in this case.

catbears avatar Apr 23 '23 08:04 catbears