Change close method to discard changes #33
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In our company's design flow, they generate docx files marked as 'ReadOnly' by some internal Word mechanism. If you open the file manually, Word prompts if you want to open it read only or not. The method of opening by docx2pdf apparently makes Word think you've opened it as write and wants to save changes.
Something recently changed in Word (I guess) that changes the error to docx2pdf such that it crashes it if you cancel the save window that pops up. This causes the script to bomb and not iterate over the batch items.
Changing doc.Close() to doc.Close(0) tell word to discard changes. I would use the proper enum for the option (wdDoNotSaveChanges) but I couldn't be arsed to figure out where in python-land that might be defined.