I have a python code that generates a report in .pmd
format, and then renders it as an html with this command:
import subprocess
cmd_pweave = "pweave -f md2html file.pmd"
subprocess.run(cmd_pweave, shell=True, check=True)
I want to avoid calling the terminal, because that can be a problem with integrability with windows (right now I'm using a mac).
So the question is: is there a way to render this pmd file to html with the python pweave library? I've looked through the doc, but I can't find how to do it.
It should be something like:
import pweave
# Weave a pandoc document with default options
pweave.weave('file.pmd')
Python pweave module doc is here http://mpastell.com/pweave/pweave.html#simple-weaving-and-tangling and an example in pmd is here: http://mpastell.com/pweave/_downloads/FIR_designp.pmd
Any help is appreciated
UPDATE: here is the traceback
File "/Applications/miniconda3/envs/ptools/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3326, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-6-32aca0d5d946>", line 2, in <module>
pweave.weave("path with spaces/dt_2020_04_19__19_51_11/ptools_analysis_2020_04_19__19_51_11.pmd")
File "/Applications/miniconda3/envs/ptools/lib/python3.7/site-packages/pweave/__init__.py", line 59, in weave
doc.weave()
File "/Applications/miniconda3/envs/ptools/lib/python3.7/site-packages/pweave/pweb.py", line 192, in weave
self.run()
File "/Applications/miniconda3/envs/ptools/lib/python3.7/site-packages/pweave/pweb.py", line 127, in run
self.wd
File "/Applications/miniconda3/envs/ptools/lib/python3.7/site-packages/pweave/processors/jupyter.py", line 169, in __init__
super(IPythonProcessor, self).__init__(*args, embed_kernel=embed)
File "/Applications/miniconda3/envs/ptools/lib/python3.7/site-packages/pweave/processors/jupyter.py", line 34, in __init__
km.start_kernel(cwd=path, stderr=open(os.devnull, 'w'))
File "/Applications/miniconda3/envs/ptools/lib/python3.7/site-packages/ipykernel/inprocess/manager.py", line 46, in start_kernel
self.kernel = InProcessKernel(parent=self, session=self.session)
File "/Applications/miniconda3/envs/ptools/lib/python3.7/site-packages/ipykernel/inprocess/ipkernel.py", line 72, in __init__
super(InProcessKernel, self).__init__(**traits)
File "/Applications/miniconda3/envs/ptools/lib/python3.7/site-packages/ipykernel/ipkernel.py", line 67, in __init__
kernel = self,
File "/Applications/miniconda3/envs/ptools/lib/python3.7/site-packages/traitlets/config/configurable.py", line 423, in instance
'%s are being created.' % cls.__name__
traitlets.config.configurable.MultipleInstanceError: Multiple incompatible subclass instances of InProcessInteractiveShell are being created.```