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

TypeError: object of type 'NoneType' has no len( #11

Open
AJue3101 opened this issue Feb 5, 2022 · 0 comments
Open

TypeError: object of type 'NoneType' has no len( #11

AJue3101 opened this issue Feb 5, 2022 · 0 comments

Comments

@AJue3101
Copy link

AJue3101 commented Feb 5, 2022

Hi Everyone,

i get this error running add_recipe_2016()

Adding OzoneFormationEcosystems
Adding HumanCarcinogenicToxicity
Adding LandOccupation
Adding FreshwaterEutrophication
Adding MarineEutrophication
Adding OzoneFormationHumans
Adding LandTransformation

TypeError Traceback (most recent call last)
Input In [7], in
----> 1 add_recipe_2016()

File ~\miniconda3\envs\MENA-Fuels\lib\site-packages\bw_recipe_2016_init_.py:112, in add_recipe_2016(version)
110 print("Adding {}".format(c.name))
111 category = c(data[i], biosphere, version)
--> 112 category.apply_strategies(verbose=False)
113 try:
114 category.drop_unlinked(verbose=False)

File ~\miniconda3\envs\MENA-Fuels\lib\site-packages\bw2io\importers\base.py:69, in ImportBase.apply_strategies(self, strategies, verbose)
67 total = len(func_list)
68 for i, func in enumerate(func_list):
---> 69 self.apply_strategy(func, verbose)
70 if hasattr(self, "signal") and hasattr(self.signal, "emit"):
71 self.signal.emit(i + 1, total)

File ~\miniconda3\envs\MENA-Fuels\lib\site-packages\bw2io\importers\base.py:48, in ImportBase.apply_strategy(self, strategy, verbose)
46 print("Applying strategy: {}".format(func_name))
47 try:
---> 48 self.data = strategy(self.data)
49 self.applied_strategies.append(func_name)
50 except StrategyError as err:

File ~\miniconda3\envs\MENA-Fuels\lib\site-packages\bw_recipe_2016\strategies\matching.py:81, in match_multiple(data, other)
78 if cf["name"].lower() in other_dict:
79 to_remove.append(cf)
80 to_add.extend(
---> 81 [
82 add_flow(deepcopy(cf), ds)
83 for ds in other_dict[cf["name"].lower()]
84 if category_match(ds, cf)
85 ]
86 )
87 else:
88 for synonym in cf.get("synonyms", []):

File ~\miniconda3\envs\MENA-Fuels\lib\site-packages\bw_recipe_2016\strategies\matching.py:84, in (.0)
78 if cf["name"].lower() in other_dict:
79 to_remove.append(cf)
80 to_add.extend(
81 [
82 add_flow(deepcopy(cf), ds)
83 for ds in other_dict[cf["name"].lower()]
---> 84 if category_match(ds, cf)
85 ]
86 )
87 else:
88 for synonym in cf.get("synonyms", []):

File ~\miniconda3\envs\MENA-Fuels\lib\site-packages\bw_recipe_2016\strategies\matching.py:42, in category_match(a, b)
38 def category_match(a, b):
39 """Return bool, whether the starting categories in a match the categories in b.
40
41 For example, category_match({'categories': ('foo',)}, {"categories": ('foo', 'bar')}) is true."""
---> 42 return tuple(a["categories"][: len(b["categories"])]) == tuple(b["categories"])

TypeError: object of type 'NoneType' has no len()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant