Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migration simapro-water missing #35

Closed
aleksandra-kim opened this issue Jan 16, 2017 · 4 comments
Closed

migration simapro-water missing #35

aleksandra-kim opened this issue Jan 16, 2017 · 4 comments
Labels
bug Something isn't working major

Comments

@aleksandra-kim
Copy link
Member

Original report by Pascal Lesage (Bitbucket: MPa, ).


Upon import of SimaPro CSV, apply_strategies() fails because migration simapro-water missing.
Version: bw2io-0.5.7

Traceback:


AssertionError Traceback (most recent call last)
in ()
6 #correctUncertaintyInformation(sp)
7 sp.migrate('simapro-ecoinvent-3')
----> 8 sp.apply_strategies()
9 sp.match_database("ecoinvent 2.2",ignore_categories=True)
10 #sp.write_database()

C:\bw2-python\envs\bw2\lib\site-packages\bw2io\importers\base.py in apply_strategies(self, strategies, verbose)
70 func_list = self.strategies if strategies is None else strategies
71 for func in func_list:
---> 72 self.apply_strategy(func, verbose)
73 if verbose:
74 print("Applied {} strategies in {:.2f} seconds".format(

C:\bw2-python\envs\bw2\lib\site-packages\bw2io\importers\base.py in apply_strategy(self, strategy, verbose)
50 print("Applying strategy: {}".format(func_name))
51 try:
---> 52 self.data = strategy(self.data)
53 self.applied_strategies.append(func_name)
54 except StrategyError as err:

C:\bw2-python\envs\bw2\lib\site-packages\bw2io\strategies\migrations.py in migrate_exchanges(db, migration)
33
34 def migrate_exchanges(db, migration):
---> 35 assert migration in migrations, u"Can't find migration {}".format(migration)
36 migration_data = Migration(migration).load()
37

AssertionError: Can't find migration simapro-water

@aleksandra-kim
Copy link
Member Author

Original comment by Chris Mutel (Bitbucket: cmutel, GitHub: cmutel).


This migration (like all core migrations) is created when you run create_core_migrations (see source). I guess you need to run create_core_migrations again, as it seems that your project was created using a version of brightway2-io less than 0.5.7.

@aleksandra-kim
Copy link
Member Author

Original comment by Pascal Lesage (Bitbucket: MPa, ).


" I guess you need to run this again on a project that was created using a version less than 0.5.7."
Not sure what was meant, but I understand that the create_core_migrations, which is run with bw2setup(), can be called to import the migrations.
I have done so in my older project, and my problem went away.

@aleksandra-kim
Copy link
Member Author

Original comment by Chris Mutel (Bitbucket: cmutel, GitHub: cmutel).


Sorry, edited comment above for clarity.

You need to run create_core_migrations again - the simapro-water migration will be added; bw2-update.bat doesn't help in this case.

@aleksandra-kim
Copy link
Member Author

Original comment by Pascal Lesage (Bitbucket: MPa, ).


Simultaneously edited my answer because I had figured this out.
I confirm, this works.

@aleksandra-kim aleksandra-kim added major bug Something isn't working labels Mar 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working major
Projects
None yet
Development

No branches or pull requests

1 participant