Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The system cannot find the file specified. on Windows #65

Open
openSourcerer9000 opened this issue Sep 26, 2022 · 0 comments
Open

The system cannot find the file specified. on Windows #65

openSourcerer9000 opened this issue Sep 26, 2022 · 0 comments

Comments

@openSourcerer9000
Copy link

So I pip installed this and have been trying to convert a .md to pdf. On windows, FYI.

python3 -m pip install gh-md-to-html[pdf_export]
python3 -m pip install gh-md-to-html[offline_conversion]
I then grabbed the latest wkhtmltopdf for windows 64bit and added C:\Program Files\wkhtmltopdf\bin to PATH.

From CLI, I've tried every flavor possible for specifying this file, and each time get The system cannot find the file specified. with no recognition of which file path it's referring to.

cd C:\absolute\path

gh-md-to-html file.md -p <name>.pdf
gh-md-to-html "C:\\absolute\\path\\file.md" -p <name>.pdf
gh-md-to-html "C:\absolute\path\file.md" -p <name>.pdf
gh-md-to-html "C:/absolute/path/file.md" -p <name>.pdf
gh-md-to-html "./file.md" -p <name>.pdf

I then tried it from Python, with cwd as C:\absolute\path

import gh_md_to_html
gh_md_to_html.main('file.md',output_pdf='file.pdf')

It creates an images and github-markdown-css folder and populates them, then a stacktrace of the same error:

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_23632/3088507330.py in <module>
----> 1 gh_md_to_html.main('comments.md',output_pdf='comments.pdf')

c:\Users\seanm\Anaconda3\envs\raz\lib\site-packages\gh_md_to_html\__init__.py in main(md_origin, origin_type, website_root, destination, image_paths, css_paths, output_name, output_pdf, style_pdf, footer, math, formulas_supporting_darkreader, extra_css, core_converter, compress_images, enable_image_downloading, box_width, toc, dont_make_images_links, soft_wrap_in_code_boxes, suppress_online_fallbacks, validate_html, emoji_support, enable_css_saving)
   1319 
   1320         # check which version of wkhtmltopdf we have installed
-> 1321         version_str = str(subprocess.check_output(["wkhtmltopdf", "-V"]), encoding="UTF-8").strip()
   1322         if version_str.startswith("wkhtmltopdf "):
   1323             version_str = version_str.split(" ", 1)[1]

c:\Users\seanm\Anaconda3\envs\raz\lib\subprocess.py in check_output(timeout, *popenargs, **kwargs)
    422         kwargs['input'] = empty
    423 
--> 424     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
    425                **kwargs).stdout
    426 

c:\Users\seanm\Anaconda3\envs\raz\lib\subprocess.py in run(input, capture_output, timeout, check, *popenargs, **kwargs)
    503         kwargs['stderr'] = PIPE
    504 
--> 505     with Popen(*popenargs, **kwargs) as process:
    506         try:
    507             stdout, stderr = process.communicate(input, timeout=timeout)

c:\Users\seanm\Anaconda3\envs\raz\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, user, group, extra_groups, encoding, errors, text, umask)
    949                             encoding=encoding, errors=errors)
    950 
--> 951             self._execute_child(args, executable, preexec_fn, close_fds,
    952                                 pass_fds, cwd, env,
    953                                 startupinfo, creationflags, shell,

c:\Users\seanm\Anaconda3\envs\raz\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_gid, unused_gids, unused_uid, unused_umask, unused_start_new_session)
   1418             # Start the process
   1419             try:
-> 1420                 hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
   1421                                          # no special security
   1422                                          None, None,

FileNotFoundError: [WinError 2] The system cannot find the file specified

This suggests to me that it's not finding wkhtmltopdf or something, even though I added it to PATH. Have you noticed anything like this before?

I am able to get it into an HTML with gh_md_to_html.main('file.md',destination='file.html'), and it copies over the images to a new folder, however they don't appear in the HTML doc. A single file PDF is definitely preferable for me though. I like writing documentation in VSCode in MD, and literally just want to be able to send docs to my colleagues who don't know what a markdown is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant