-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
List out of range error when opening file #25
Comments
After some additional testing, the error seems to occur when the merge fields are located in a table cell. When the fields are moved outside of the table, there is no problem at all. Any idea why this would cause a problem? |
I'll have a look into it, can you provide a sample docx so that I can reproduce the error ? |
@iulica Sure, here you go. |
Oh, I now noticed you are using the 0.6.3 version, that's quite old. Would you care testing it with the latest version ? Your document seems to work fine for me. |
I included a fix and released it with 0.8.2 |
Great find! I hadn't even noticed that, but makes sense why it would cause that error. Appreciate the fix so quickly! |
Hi there,
I have a particular docx file that I'm trying to use for a merge, but I keep getting a
list index out of range
error related to_get_field_type
(specifically line 393return s[0], s[1:]
whereinstr
is an empty string. Presumably an empty string shouldn't even be able to get to this point, so there's probably some error checking that's missed along the way.I'm running into this when I run
doc = MailMerge(file, remove_empty_tables=False, auto_update_fields_on_open="no")
so that I can rundoc.get_merge_fields()
.I've tried going through the code base a bit to try and figure out the error, but clearly there is something about the way it's processing the source
docx
file that's causing this and just wondering if there were any initial ideas as to what might cause this problem. As it stands, I can't figure out it out enough to check for the issue in advance.For reference, it's running Python 3.9.6, and
docx-mailmerge2
version 0.6.3.The text was updated successfully, but these errors were encountered: