xlsx2csv
xlsx2csv copied to clipboard
NameError: global name 'eprint' is not defined
Hey, we are using xlsx2csv
to import sheets and it generally works fine.
Recently, while trying to upload a specific sheet we got the following error:
File "/home/rof/.pyenv/versions/2.7.16/bin/xlsx2csv", line 817, in handleCharData
eprint("Error: potential invalid date format.")
NameError: global name 'eprint' is not defined
We moved the eprint
method at the top of the file, and the script worked with only a warning as I assume was intended, but I am not sure if that is a correct solution?
thanks ac
same issue:
Traceback (most recent call last):
File "/usr/bin/xlsx2csv", line 803, in handleCharData
self.data = ("%f" % (float(self.data))).rstrip('0').rstrip('.')
ValueError: could not convert string to float: '#N/A'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/xlsx2csv", line 1129, in <module>
xlsx2csv.convert(outfile, sheetid)
File "/usr/bin/xlsx2csv", line 258, in convert
self._convert(s['index'], of)
File "/usr/bin/xlsx2csv", line 318, in _convert
sheet.to_csv(writer)
File "/usr/bin/xlsx2csv", line 732, in to_csv
self.parser.ParseFile(self.filehandle)
File "/usr/src/ports/python35/python35-3.5.7-1.x86_64/src/Python-3.5.7/Modules/pyexpat.c", line 282, in CharacterData
File "/usr/bin/xlsx2csv", line 817, in handleCharData
eprint("Error: potential invalid date format.")
NameError: name 'eprint' is not defined
$ xlsx2csv --version
0.7.6
thanks,
Hi there,
same issue here :/
Traceback (most recent call last):
File "/usr/bin/xlsx2csv", line 803, in handleCharData
self.data = ("%f" % (float(self.data))).rstrip('0').rstrip('.')
ValueError: could not convert string to float: '#N/A'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/xlsx2csv", line 1129, in <module>
xlsx2csv.convert(outfile, sheetid)
File "/usr/bin/xlsx2csv", line 216, in convert
self._convert(sheetid, outfile)
File "/usr/bin/xlsx2csv", line 318, in _convert
sheet.to_csv(writer)
File "/usr/bin/xlsx2csv", line 732, in to_csv
self.parser.ParseFile(self.filehandle)
File "../Modules/pyexpat.c", line 272, in CharacterData
File "/usr/bin/xlsx2csv", line 817, in handleCharData
eprint("Error: potential invalid date format.")
NameError: name 'eprint' is not defined
xlsx2csv --version
0.7.5
Can someone send me a sample file to reproduce this?
Sure, I created a minimal example with one cell filled only. It seems to be connected (in my case at least) with the formatting of the cell.
> xlsx2csv Book1.xlsx
Traceback (most recent call last):
File "/usr/bin/xlsx2csv", line 803, in handleCharData
self.data = ("%f" % (float(self.data))).rstrip('0').rstrip('.')
ValueError: could not convert string to float: '#N/A'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/xlsx2csv", line 1129, in <module>
xlsx2csv.convert(outfile, sheetid)
File "/usr/bin/xlsx2csv", line 216, in convert
self._convert(sheetid, outfile)
File "/usr/bin/xlsx2csv", line 318, in _convert
sheet.to_csv(writer)
File "/usr/bin/xlsx2csv", line 732, in to_csv
self.parser.ParseFile(self.filehandle)
File "../Modules/pyexpat.c", line 272, in CharacterData
File "/usr/bin/xlsx2csv", line 817, in handleCharData
eprint("Error: potential invalid date format.")
NameError: name 'eprint' is not defined
Here is the file: Book1.xlsx
Hm, I'm getting:
./xlsx2csv.py ~/Downloads/Book1.xlsx Error: potential invalid date format. #N/A
On boh python 2 and 3. What version of xlsx2csv are you using?
xlsx2csv --version 0.7.5
This one!
You're using the .py
version, I'm using the binary installed via apt install xlsx2csv
. Does that make a difference?
It seems it does. I don't know how apt version is uploaded, I'm uploading only pypy version.
I am also facing similar issue. xlsx2csv version 0.7.5. Anybody have any solution for this? Please suggest.
Traceback (most recent call last):
File "/usr/bin/xlsx2csv", line 803, in handleCharData
self.data = ("%f" % (float(self.data))).rstrip('0').rstrip('.')
ValueError: could not convert string to float: '#N/A'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/xlsx2csv", line 1129, in <module>
xlsx2csv.convert(outfile, sheetid)
File "/usr/bin/xlsx2csv", line 216, in convert
self._convert(sheetid, outfile)
File "/usr/bin/xlsx2csv", line 318, in _convert
sheet.to_csv(writer)
File "/usr/bin/xlsx2csv", line 732, in to_csv
self.parser.ParseFile(self.filehandle)
File "../Modules/pyexpat.c", line 272, in CharacterData
File "/usr/bin/xlsx2csv", line 817, in handleCharData
eprint("Error: potential invalid date format.")
NameError: name 'eprint' is not defined