I'm new to Python (and to stackoverflow) and my first task is to convert an energy flow simulation program from Python 2.7 to Python 3.6 and get it running on 3.6. I already used the 2to3 converter and solved some other errors but now I'm hitting a wall with this error, not knowing if it's an error of the existing program or if I use the wrong syntax etc. The code apparently worked in Python 2. If I additionaly put in house_atrs in the function it will start the function but throws a long list of other errors. So I hope for your help and would like to understand the reason of this error in 3.6 compared to 2.7.
Error:
Traceback (most recent call last):
File "D:\Users\hs\workspace\selfsuffbat\vpp_interface_refpool_noPCR_161026.py",
line 85, in <module>
analyze(sim_atrs, output_folder, output_subfolder, economic=True, binary=True)
TypeError: analyze() missing 1 required positional argument: 'output_subfolder'
Code of vpp_interface_refpool_noPCR161026.py:
from pool_builder import pool_df
from main import simulate
from main import analyze
if __name__ == '__main__':
output_folder = 'output/data/'
output_subfolder = 'refpool_noPCR'
[...]
simulate(house_atrs, sim_atrs, sim_args, output_folder, output_subfolder)
analyze(sim_atrs, output_folder, output_subfolder, economic=True, binary=True)
Code of the function analyze() in main.py:
def analyze(sim_atrs, house_atrs, output_folder, output_subfolder, economic=True, economic_standalone=False, binary=False):
print('started analyzing')
analysis(folder=output_folder, subfolder=output_subfolder, fileindata=None, firstloop=True, binary=binary,
usegreengrey=sim_atrs['use_greengrey'], usedegradation=sim_atrs['use_degradation'],
uselocalbalance=sim_atrs['use_localbalance'], providePCR=sim_atrs['provide_pcr'],
usethermal=sim_atrs['use_thermal_load'])
if economic:
assert economic_standalone is False, 'Set "economic" to False and "economic_standalone" to True for standalone calculations'
economic_calc(output_folder, output_subfolder, year=2015, useselfsufficiency=sim_atrs['use_localbalance'])
elif economic_standalone:
assert economic is False, 'Set "economic" to True and "economic_standalone" to False for pooled calculations'
economic_standalone_calc(output_folder, output_subfolder, year=2015, useselfsufficiency=sim_atrs['use_localbalance'])
print('finished analyzing')
if __name__ == '__main__':
pass