Closed wangdaye078 closed 2 years ago
@newhying thank you for considering using pylightxl for your project. Can you post the full traceback where this was an issue. The following line should be sufficient to handle tags
for i, tag_si in enumerate(root.findall('./default:si', ns)):
tag_t = tag_si.findall('./default:r//default:t', ns)
if tag_t:
text = ''.join([tag.text for tag in tag_t])
else:
text = tag_si.findall('./default:t', ns)[0].text
sharedStrings.update({i: text})
Traceback (most recent call last): ......................... t_driver.workbook = pylightxl.readxl(filename) File "d:\python\python38\lib\site-packages\pylightxl\pylightxl.py", line 129, in readxl sharedString = readxl_get_sharedStrings(fn) File "d:\python\python38\lib\site-packages\pylightxl\pylightxl.py", line 319, in readxl_get_sharedStrings text = ''.join([tag.text for tag in tag_t]) TypeError: sequence item 1: expected str instance, NoneType found
open sharedStrings.xml find this
<si>
<r>
<t>lvUpNum2_i</t>
</r>
<r>
<rPr>
<sz val="10"/>
<color indexed="8"/>
<rFont val="宋体"/>
<family val="3"/>
<charset val="134"/>
</rPr>
<t/>
</r>
</si>
I see, great thanks for submitting this. This should be an easy update. I'll make the change now and once the other issue is also close we'll release a new version.
will be released in v1.59 later today, thanks for submitting this
Hey @PydPiper any chance to get a new release ? Thanks :)
@yohanboniface hey yes sorry ive been tied up with school. I’ll take a look at releasing a new version today after work. Thanks for the reminder!
@yohanboniface v1.59 was released with this update. Thank you again for the reminder!
Thanks @PydPiper :)
Pylightxl Version:1.58 Python Version:3.8
Suggestion for fix: in def readxl_get_sharedStrings(fn)
text = ''.join([tag.text for tag in tag_t]) maybe chang to: text = ''.join([tag.text for tag in tag_t if tag.text])
because some time tag.text is None