banillie / projectlibrary

0 stars 1 forks source link

generic crash #5

Closed banillie closed 4 years ago

banillie commented 4 years ago

When running analysis_engine getting a crash across all code. Would seem to be something to do with how master wbs are being converted into dictionaries in projectlibrary/data code. no idea what's caused this, code was working fine and then suddenly got this error.


  File "<input>", line 1, in <module>
  File "/snap/pycharm-community/194/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_umd.py", line 197, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  File "/snap/pycharm-community/194/plugins/python-ce/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/home/will/code/python/analysis_engine/baselining/amend_baselines.py", line 2, in <module>
    from analysis.data import list_of_masters_all, root_path, red_text
  File "/snap/pycharm-community/194/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/home/will/.virtualenvs/a_engine/src/projectlibrary/analysis/data.py", line 22, in <module>
    q4_1920 = project_data_from_master(root_path/'core_data/master_4_2019.xlsx', 4, 2019)
  File "/home/will/.virtualenvs/a_engine/lib/python3.7/site-packages/datamaps/api/api.py", line 14, in project_data_from_master_api
    m = Master(Quarter(quarter, year), master_file)
  File "/home/will/.virtualenvs/a_engine/lib/python3.7/site-packages/datamaps/plugins/dft/master.py", line 120, in __init__
    self._data = project_data_from_master(self.path)
  File "/home/will/.virtualenvs/a_engine/lib/python3.7/site-packages/datamaps/plugins/dft/portfolio.py", line 12, in project_data_from_master
    wb = load_workbook(master_file)
  File "/home/will/.virtualenvs/a_engine/lib/python3.7/site-packages/openpyxl/reader/excel.py", line 316, in load_workbook
    data_only, keep_links)
  File "/home/will/.virtualenvs/a_engine/lib/python3.7/site-packages/openpyxl/reader/excel.py", line 124, in __init__
    self.archive = _validate_archive(fn)
  File "/home/will/.virtualenvs/a_engine/lib/python3.7/site-packages/openpyxl/reader/excel.py", line 96, in _validate_archive
    archive = ZipFile(filename, 'r')
  File "/usr/lib/python3.7/zipfile.py", line 1225, in __init__
    self._RealGetContents()
  File "/usr/lib/python3.7/zipfile.py", line 1292, in _RealGetContents
    raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file```
yulqen commented 4 years ago

Can you let me know what python file you ran here? Anything weird about core_data/master_4_2019.xlsx? For some reason, it's not being recognised as a genuine xlsx file. Have you tried resaving that file in Excel or LibreOffice?

yulqen commented 4 years ago

Just saw your Teams message. Glad its sorted!

banillie commented 4 years ago

@hammerheadlemon thanks.