Open Pyxl is printing output to terminal during file read

Issue #138 resolved
Mitch LeBlanc created an issue

Hello,

First of all, thank you for the marvelous code, openpyxl is wonderful. I am using it like crazy, and love it.

I found a minor issue, I think:

I am loading an .xlsx file, reading sheets and saving cell values. Nothing particularly complicated. When I do this, however, on a particularly large and ugly file, openpyxl prints some ranges and True or False to the command line.

Looks like: {{{ 'Sheetname'!$AR:$AR False 'Sheetname'!$A3:$D412 True etc... }}}

It prints about 4 of these, all of which appear to be named ranges in the workbook, and occurs during the line:

{{{ from openpyxl import load_workbook book = load_workbook(file_name) # prints output here }}}

After a bit (a lot) of searching I found a print statement in the code in the "namedrange.py" file:

{{{ def refers_to_range(range_string): print range_string, bool(NAMED_RANGE_RE.match(range_string)) return bool(NAMED_RANGE_RE.match(range_string)) }}}

this function is called from line 123 of the workbook.py "read_named_ranges": {{{ if refers_to_range(name_node.text): }}}

I could send you the offending spreadsheet, if you would care to take a look, but it's work related so don't really want to post it online.

Have you seen this issue before? I assume this print statement was just a bit of debugging that is fine to delete?

Thanks,

Mitch

ps: My site-packages says openpyxl-1.5.8

Comments (2)

  1. Former user Account Deleted

    Thanks for that. Looks like an artifact the developer(s) left in during development (probably bug chasing).

    My site was having same problem...I've commented it out and have noticed no ill effects so far.

  2. Log in to comment