AlJohri / docx2pdf

MIT License
506 stars 96 forks source link

Conversion error on Windows Server while scheduling the python script on Task Scheduler #26

Closed anoopkrishnak closed 3 years ago

anoopkrishnak commented 3 years ago

Hi

Python script couldn't open the word file while running from the scheduler task. It return null value but the same script is working when the script is executed from Command Prompt.

Calling the method convert(source, destination)

Error come from the method def windows(paths, keep_active): doc = word.Documents.Open(str(docx_filepath))

AlJohri commented 3 years ago

hi @anoopkrishnak, looks like you're running into this issue: https://superuser.com/questions/579900/why-cant-excel-open-a-file-when-run-from-task-scheduler

the consensus seems to be "Microsoft doesn't support running Office COM components in non-interactive sessions" this answer in particular seems like an easy (but perhaps unsupported) fix: https://superuser.com/a/655458

AlJohri commented 3 years ago

Closing this issue but feel free to continue the conversation if there's any changes that need to be made to docx2pdf!

anoopkrishnak commented 3 years ago

Yes. I was using the workaround provided on the same link (https://superuser.com/a/655458) to resolve the issue on Dev environment but there is huge risk in using workaround as permanent fix. Is there any other ways to resolve the issue as permanent solution?