QSD-Group / EXPOsan

EXPOsition of sanitation and resource recovery systems
https://qsdsan.com
Other
16 stars 6 forks source link

runtime warning when running country_specific.py in the biogenic refinery branch #2

Closed lane-to closed 2 years ago

lane-to commented 2 years ago

see attached screenshots

Screen Shot 2022-01-31 at 5 10 58 PM Screen Shot 2022-01-31 at 5 11 42 PM Screen Shot 2022-01-31 at 5 12 15 PM
yalinli2 commented 2 years ago

Thanks @lane-to for the post!

The culprit is repeat importing, specially this line:

from systems import price_dct

When doing this, Python runs systems.py (in order to import price_dct), but later, you also have:

systems = br.systems
sys_dct = systems.sys_dct
price_dct = systems.price_dct
GWP_dct = systems.GWP_dct
GWP = systems.GWP

And Python needs to run systems.py again, thus all the objects are recreated.

Taking out that from systems import price_dct line should let all the warnings go away, but you also have a lot of other imported but not used modules/objects (Spyder flags them with the yellow triangle with an exclamation mark inside)

image

You can take out all the modules that Spyder flags, so (with minor modifications to consolidate the codes)

from exposan import biogenic_refinery as br
import pandas as pd
from chaospy import distributions as shape
import biosteam as bst
from biosteam.evaluation import Model
from qsdsan.utils import load_data, data_path
from qsdsan import ImpactItem

systems = br.systems
m = br.models
sys_dct = systems.sys_dct
price_dct = systems.price_dct
GWP_dct = systems.GWP_dct
GWP = systems.GWP

In fact, because you've pulled in some of the new changes in QSDsan, you actually do:

from exposan import biogenic_refinery as br
import pandas as pd
from chaospy import distributions as shape
from qsdsan.utils import load_data, data_path
from qsdsan import ImpactItem, PowerUtility, Model

systems = br.systems
m = br.models
sys_dct = systems.sys_dct
price_dct = systems.price_dct
GWP_dct = systems.GWP_dct
GWP = systems.GWP

Hope this helps, feel free to close this issue if this solves your problem, or let me know if you run into further problems!

yalinli2 commented 2 years ago

Closing it since it's fixed