Closed laksh225 closed 4 years ago
The fix I've tried is add namespaces.update(vt = 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes')
to line 74 of ElementPath.py in the directory Lib\xml\etree.
But this generates a different error.
===== RESTART: G:\Automation\Python2_7\tally_xml_generator\transform.py =====
Traceback (most recent call last):
File "G:\Automation\Python2_7\tally_xml_generator\transform.py", line 17, in
Hi @laksh225 thank you for considering pylightxl and submitting this issue. We are taking a look at it now
Initial assessment came back negative on the latest version of pylightxl on python 2.7.18. Going to download 2.7.13 and test there
created a docker container for python 2.7.13 downloaded the sales.xlsx and pip installed the latest pylightxl. i was not able to recreate the bug you are seeing. Are you using the latest version of pylightxl?
Yes, I am using the latest version V1.47. I think I figured out the problem. The problem was that I used openpyxl on the previous run to generate the salesmodified output file and now, when I changed to pylightxl, there was some problem in rewriting that file and maybe that caused this issue. Thanks for the quick reply!!!
I tried modifying a file using the following script, but got an error as described below. I am using python 2.7.13 with windows 7. The excel sheet I imported is sales.xlsx
`import pylightxl as xl from datetime import datetime
def transform(): db = xl.readxl("sales.xlsx") sheet = db.ws("Sheet 1") k = 2 while str(sheet.index(k, 2)).startswith("VOLKPH"): inv_no_l = list(sheet.index(k, 2)) inv_no_l[5] = '0' sheet.update_index(k, 2,val = ''.join(inv_no_l)) sheet.update_index(k, 1, int(datetime.strftime(datetime.strptime(sheet.index(k, 1), format("%d-%m-%Y")), format('%Y%m%d'))))
k+=1 xl.writexl(db, "salesmodified.xlsx")
if __name_==\'__main_\\': transform() `
===== RESTART: G:\Automation\Python2_7\tally_xml_generator\transform.py =====
Traceback (most recent call last): File "G:\Automation\Python2_7\tally_xml_generator\transform.py", line 18, in
transform()
File "G:\Automation\Python2_7\tally_xml_generator\transform.py", line 15, in transform
xl.writexl(db, "salesmodified.xlsx")
File "G:\Automation\Python2_7\lib\site-packages\pylightxl\pylightxl.py", line 432, in writexl
writexl_alt_writer(db, fn)
File "G:\Automation\Python2_7\lib\site-packages\pylightxl\pylightxl.py", line 456, in writexl_alt_writer
text = writexl_alt_app_text(db, temp_folder + '/docProps/app.xml')
File "G:\Automation\Python2_7\lib\site-packages\pylightxl\pylightxl.py", line 586, in writexl_alt_app_text
tag_vt_vector = root.find('./default:HeadingPairs//vt:vector', ns)
File "G:\Automation\Python2_7\lib\xml\etree\ElementPath.py", line 286, in find
return iterfind(elem, path, namespaces).next()
File "G:\Automation\Python2_7\lib\xml\etree\ElementPath.py", line 264, in iterfind
selector.append(ops[token[0]](next, token))
File "G:\Automation\Python2_7\lib\xml\etree\ElementPath.py", line 120, in prepare_descendant
token = next()
File "G:\Automation\Python2_7\lib\xml\etree\ElementPath.py", line 84, in xpath_tokenizer
raise SyntaxError("prefix %r not found in prefix map" % prefix)
SyntaxError: prefix 'vt' not found in prefix map