AlJohri / docx2pdf

MIT License
497 stars 94 forks source link

Issue running docx2pdf in CLI and python #62

Closed erukumk closed 2 years ago

erukumk commented 2 years ago

Hey, I recently had to reset my laptop, since then i am having issues running docx2pdf from both CLI and python.

Package docx2pdf is already installed.

CLI - 'docx2pdf' is not recognized as an internal or external command, operable program or batch file even after adding the exe to path variable When directly gave path to the exe for running, got below error Traceback (most recent call last):

 File "C:\tools\miniconda3\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\tools\miniconda3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\tools\miniconda3\Scripts\docx2pdf.exe\__main__.py", line 7, in <module>
  File "C:\tools\miniconda3\lib\site-packages\docx2pdf\__init__.py", line 170, in cli
    convert(args.input, args.output, args.keep_active)
  File "C:\tools\miniconda3\lib\site-packages\docx2pdf\__init__.py", line 106, in convert
    return windows(paths, keep_active)
  File "C:\tools\miniconda3\lib\site-packages\docx2pdf\__init__.py", line 17, in windows
    import win32com.client
  File "C:\tools\miniconda3\lib\site-packages\win32com\__init__.py", line 5, in <module>
    import win32api, sys, os
ImportError: DLL load failed while importing win32api: The specified module could not be found.

Python - when tried to use python to generate PDF's File ~\.spyder-py3\temp.py:8 in <module>, from docx2df import convert, ModuleNotFoundError: No module named 'docx2df',

Can anyone help me how to get around this?

Other information which may or may not be helpful.

  1. Not a great coder.
  2. Earlier it was a standalone python installation, now python is part of miniconda, but package exists at C:\tools\miniconda3\Lib\site-packages\docx2pdf
erukumk commented 2 years ago

It was a problem with pywin32, Fixed the issue using solution here. python C:\path\to\Scripts\pywin32_postinstall.py -install