You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Please include the full traceback if there was an exception]
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.11/site-packages/pycel/excelformula.py", line 923, in eval_func
excel_formula.compiled_lambda())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/pycel/excelformula.py", line 948, in
### Traceback will show this line if not loaded from a text file
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/pycel/lib/stats.py", line 203, in countif
valid = find_corresponding_index(rng, criteria)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/pycel/excelutil.py", line 1104, in find_corresponding_index
return tuple(find_corresponding_index_generator(rng, criteria))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/pycel/excelutil.py", line 1113, in
for c, item in enumerate(row) if check(item))
^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/pycel/excelutil.py", line 1031, in
return lambda x: x is not None and compiled.match(x.lower()) is not None
^^^^^^^
AttributeError: 'int' object has no attribute 'lower'
What was expected to happen
If I cast x to string before calling lower, I get the right output
Problem description
[If needed, this should explain why the current behavior is a problem and why the expected output is a better solution]
Evaluation is failing when it shouldn't be
Code Sample
# Your code hereworkbook=openpyxl.load_workbook(tmp_xlsx)
workbook_compiler=ExcelCompiler(excel=workbook)
workbook_compiler.evaluate(get_cell_coordinate(cell, sheet_name))
I monkey patched build_wildcard_re in my code which solved my issues, but really didn't get too deep into the weeds here because I just need my thing to work
# ========= Start Monkey Patch =========QUESTION_MARK_RE=re.compile(r'\?(?<!~)')
STAR_RE=re.compile(r'\*(?<!~)')
defbuild_wildcard_re_fixed(lookup_value):
regex=QUESTION_MARK_RE.sub('.', STAR_RE.sub('.*', lookup_value))
ifregex!=lookup_value:
# this will be a regex match"""compiled=re.compile(f'^{regex.lower()}$')
returnlambdax: xisnotNoneandcompiled.match(str(x).lower()) isnotNoneelse:
returnNoneexcelutil.build_wildcard_re=build_wildcard_re_fixed# ========= End Monkey Patch =========
What actually happened
[Please include the full traceback if there was an exception]
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.11/site-packages/pycel/excelformula.py", line 923, in eval_func
excel_formula.compiled_lambda())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/pycel/excelformula.py", line 948, in
### Traceback will show this line if not loaded from a text file
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/pycel/lib/stats.py", line 203, in countif
valid = find_corresponding_index(rng, criteria)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/pycel/excelutil.py", line 1104, in find_corresponding_index
return tuple(find_corresponding_index_generator(rng, criteria))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/pycel/excelutil.py", line 1113, in
for c, item in enumerate(row) if check(item))
^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/pycel/excelutil.py", line 1031, in
return lambda x: x is not None and compiled.match(x.lower()) is not None
^^^^^^^
AttributeError: 'int' object has no attribute 'lower'
What was expected to happen
If I cast x to string before calling lower, I get the right output
Problem description
[If needed, this should explain why the current behavior is a problem and why the expected output is a better solution]
Evaluation is failing when it shouldn't be
Code Sample
[If possible, include a minimal, complete, and verifiable example to help us identify the issue. This also helps check that the issue is not with your own code]
Environment
[Pycel Version, Python Version and OS used. Also any other environment details that you think might be relevant]
Python 3.11
Pycel 1.0b30
The text was updated successfully, but these errors were encountered: