ASD Researcher
ASD Researcher

Reputation: 1

WinError 5: Access is denied when trying to write pdf with pylatex

Code:

import pylatex as pl
#import latexmk

doc = pl.Document()
doc.append(pl.Math(data=['x^2+3x+1']))
path = r"C:/Users/maach/OneDrive/Documents/Python Scripts/mathfile"
doc.generate_pdf(clean_tex=False,compiler=r'C:/Users/maach/anaconda3/pkgs/latexmk-4.76-h57928b3_0\Scripts', filepath = path)

Spyder Kernel:

runfile('C:/Users/maach/OneDrive/Documents/Python Scripts/untitled1.py', wdir='C:/Users/maach/OneDrive/Documents/Python Scripts') Traceback (most recent call last):

File ~\OneDrive\Documents\Python Scripts\untitled1.py:7 in doc.generate_pdf(clean_tex=False,compiler=r'C:/Users/maach/anaconda3/pkgs/latexmk-4.76-h57928b3_0\Scripts', filepath = path)

File ~\anaconda3\lib\site-packages\pylatex\document.py:250 in generate_pdf output = subprocess.check_output(command,

File ~\anaconda3\lib\subprocess.py:424 in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,

File ~\anaconda3\lib\subprocess.py:505 in run with Popen(*popenargs, **kwargs) as process:

File ~\anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py:108 in init super(SubprocessPopen, self).init(*args, **kwargs)

File ~\anaconda3\lib\subprocess.py:951 in init self._execute_child(args, executable, preexec_fn, close_fds,

File ~\anaconda3\lib\subprocess.py:1420 in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args,

PermissionError: [WinError 5] Access is denied

Perl is installed in Anaconda environments. I've tried updating pip and running Spyder as administrator. Full permissions allowed on the folder containing latexmk and the target directory. Have not seen any other questions asked like this on any programming website. How do I fix this error?

Upvotes: 0

Views: 81

Answers (0)

Related Questions