question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NameError: global name 'eprint' is not defined

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
naokikambecommented, Aug 9, 2019

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,

0reactions
Altruist2692commented, Mar 15, 2022

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
Read more comments on GitHub >

github_iconTop Results From Across the Web

Python NameError: global name not defined - Stack Overflow
Python NameError: global name not defined · 1. Of course Chunk is never defined, you never assign to it. · 2. There are...
Read more >
NameError: global name 't' is not defined - Google Groups
hay. I try to write a py script to calculate something for me. The script is called friction.py and containes #!/usr/bin/env sage -python...
Read more >
Day20-Function-Variable Scope - iT 邦幫忙
... except NameError as e: print('Name Error: {0}'.format(e)) # Name Error: name 'para1' is not defined # Name Error: name 'var2' is not...
Read more >
(15/15) NameError: global name 'true' is not defined
(15/15) NameError: global name 'true' is not defined. I have having difficulty understanding what to do. I am sure the issue is right...
Read more >
python throw error Code Example - Code Grepper
except Exception as e: print(e). Source: stackoverflow.com ... global name 'asd' is not defined ("global name 'asd' is not defined",).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found