I have a project that needs to read data, then write in more than 23 CSV files in parallel depending on each line. For example, if the line is about temperature, we should write to temperature.csv, if about humidity, >>to humid.CSV , etc.
I tried the following:
with open('Results\\GHCN_Daily\\MetLocations.csv','wb+') as locations, \
open('Results\\GHCN_Daily\\Tmax.csv','wb+')as tmax_d, \
open('Results\\GHCN_Daily\\Tmin.csv','wb+')as tmin_d, \
open('Results\\GHCN_Daily\\Snow.csv', 'wb+')as snow_d, \
.
.
# total of 23 'open' statements
.
open('Results\\GHCN_Daily\\SnowDepth.csv','wb+')as snwd_d, \
open('Results\\GHCN_Daily\\Cloud.csv', 'wb+')as cloud_d, \
open('Results\\GHCN_Daily\\Evap.csv', 'wb+')as evap_d, \
I got the following error
SystemError: too many statically nested blocks python
I searched for this error, and I get to this post which says that
You will encounter this error when you nest blocks more than 20. This is a design decision of Python interpreter to restrict it to 20.
But the open statement I wrote opens the files in parallel, not nested.
What am I doing wrong, and how can I solve this problem?
Thanks in advance.