Closed tnmeesters closed 1 year ago
Hi,
tqdm is a progress bar that is displayed in the console window. Because Enso is launched using pythonw, there is no console window, so it might not work as expected. So, this error is not directly related to Enso.
A possible solutions might be:
sys.stderr = open("/path/to/a/writable/directory/stderr.log", "w")
before calling convert,
If docx2pdf has no option to disable the console output, it may be necessary to edit its sources to manually disable it.
Use another docx to pdf conversion library.
Hello,
I'm trying to create a new script within the 'Enso Command Editor' but I'm getting an error that I do not understand.
Below is what I have in the command editor. I have installed the docx2pdf package.
from docx2pdf import convert from pathlib import Path
def cmd_convert_docx_to_pdf(ensoapi): """ Convert docx to pdf """ seldict = ensoapi.get_selection()
This is the error that I get with the traceback command.
Scriptotron exception: Traceback (most recent call last): File "C:\Data\Programs\Enso\enso\contrib\scriptotron\tracebacks.py", line 63, in wrapper return func( *args, *kwargs ) File "C:\Data\Programs\Enso\enso\contrib\scriptotron\adapters.py", line 35, in run result = self.func(self.ensoapi) File "C:\Data\Programs\Enso.enso\commands\user.py", line 60, in cmd_convert_docx_to_pdf docx2pdf.convert(r"C:\Users\SpecificUser\Desktop\test.docx", r"C:\Users\SpecificUser\Desktop\test.pdf") File "C:\Data\Programs\Enso\python\lib\site-packages\docx2pdf__init.py", line 106, in convert return windows(paths, keep_active) File "C:\Data\Programs\Enso\python\lib\site-packages\docx2pdf__init.py", line 29, in windows pbar = tqdm(total=1) File "C:\Data\Programs\Enso\python\lib\site-packages\tqdm\asyncio.py", line 24, in init__ super(tqdm_asyncio, self).init__(iterable, args, *kwargs) File "C:\Data\Programs\Enso\python\lib\site-packages\tqdm\std.py", line 1109, in init self.refresh(lock_args=self.lock_args) File "C:\Data\Programs\Enso\python\lib\site-packages\tqdm\std.py", line 1361, in refresh self.display() File "C:\Data\Programs\Enso\python\lib\site-packages\tqdm\std.py", line 1509, in display self.sp(self.str() if msg is None else msg) File "C:\Data\Programs\Enso\python\lib\site-packages\tqdm\std.py", line 350, in print_status fp_write('\r' + s + (' ' max(last_len[0] - len_s, 0))) File "C:\Data\Programs\Enso\python\lib\site-packages\tqdm\std.py", line 343, in fp_write fp.write(_unicode(s)) File "C:\Data\Programs\Enso\python\lib\site-packages\tqdm\utils.py", line 89, in getattr return getattr(self._wrapped, name) AttributeError: 'NoneType' object has no attribute 'write'
I think I have installed docx2pdf correctly. I use it on windows 10. Thanks for keeping Enso up and running. Still use it every day.
Thomas