LBNL-ETA / Adapter

The Adapter software is developed at the Energy Efficiency Standards Department and it provides a convenient data table loader from various formats such as xlsx, csv, db (sqlite database), and sqlalchemy. Its main feature is the ability to convert data tables identified in one main and optionally one or more additional input files into database tables and Pandas DataFrames for downstream usage in any compatible software.
1 stars 1 forks source link

Update openpyxl dependency #44

Open evaneill opened 7 months ago

evaneill commented 7 months ago

The current setup.py fixes the openpyxl dependency at 3.0.9 because later versions break one very specific segment of code in adapter.to_python here.

I think this could be fixed with:

if hasattr(self.wb.defined_names,"definedName"):
  # This case is for openpyxl <3.1.0
  all_input_ranges = {object_range.name for object_range in self.wb.defined_names.definedName}
else:
  # This case is for openpyxl ≥3.1.0
  all_input_ranges = set(self.wb.defined_names.keys())

This change was capable of getting around the error in my local environment and working, but it should be tried and ran through the adapter tests. If all seems good, then I'd advise just getting rid of the version requirement on openpyxl