brightway-lca / brightway2-io

Importing and exporting for the Brightway LCA framework
BSD 3-Clause "New" or "Revised" License
27 stars 42 forks source link

FileNotFoundError in migrated project to bw2.5 #115

Closed mfastudillo closed 3 years ago

mfastudillo commented 3 years ago

Hi all

This error may be a bit tricky to replicate, but I have tried to migrate a project from bw2 to bw2.5 and when creating a database from an excel file I got a FileNotFoundError

I was running

ei = ExcelImporter(path_exemple_excel)
ei.apply_strategies()

I tried to do the migration again, but this throws an AssertionError as the migration was already done

imagen

If I create a project from scratch and run the same code I don't find this FileNotFound error.

For the moment I'll probably restart the whole project from scratch, but I thought it was worth noting this potential problem.

@cmutel

cmutel commented 3 years ago

@mfastudillo Thanks a lot for this error report.

I changed the algorithm that creates the hash string in the filename, to make it shorter because it was causing problems on Windows (which has limits on filepath lengths). So in bw2:


>>> bi.Migration("biosphere-2-3-categories").filename
'biosphere-2-3-categories.c4c23e4d830d2b633703f1a65f9cdd0f'

While on bw25:


>>> bi.Migration("biosphere-2-3-categories").filename
'biosphere-2-3-categories.c4c23e4d'

The way to fix this is to change the filenames when switching to 2.5, this should be more or less OK, but will take a bit of time.

cmutel commented 3 years ago

Fixed in https://github.com/brightway-lca/brightway2-data/commit/d317107f7e2fd5b57a6ba5337d22c98ac617b6f6