JessicaTegner/pypandoc

Error when using pypandoc.download_pandoc() on windows

Closed this issue · 0 comments

Hey,

Thanks for pypandoc I have been using it for quite some while now ;). However, there is a tiny problem when using pypandoc.download_pandoc() on windows. The installer will be downloaded but cannot be executed due to a wrong path.

Steps to reproduce:

Create the following folder structure

.
├── app.py
├── download_folder
└── target_folder

Run

# using python 3.7.5
pipenv --three 

pipenv install pypandoc
pipenv run python -c "import pypandoc; print(pypandoc.__version__)"
# 1.5 

Run the following code snippet

from pathlib import Path 

import pypandoc 
print(pypandoc.__version__)

target_folder = Path('./target_folder').resolve()
download_folder = Path('./download_folder').resolve()
pypandoc.download(targetfolder=str(target_folder), download_folder=str(download_folder))

The installer will be downloaded to download_folder. However, the installer path passed to subprocess.check_call is wong. The path to the installer is generated via:

# pypandoc/download_pandoc.py line 195
filename = os.path.expanduser(download_folder) + '/' + filename

So the generated path on windows will be: C:\\Some\\Path\\to/my_installer.msi about which windows complains.

Thank you for looking into this :).