Closed shaharkadmiel closed 8 years ago
Actually, it says need more than 1 value to unpack
, so you're hitting a piece without an =
. Maybe a stray space in there?
Hmm... you are right
The whole parsing the config is very crude/minimalistic right now, no assertions at all.. but it was enough for my purposes so far.
I understand, I'm working on it right now. The reason it failed in this case was a comment on one of the lines after the command (not at the beginning...).
BTW, is there a reason to read the entire file and then parse it? is that quicker than reading line by line?
with open(filename) as f:
for line in f:
line = line.strip().split()
...
...
['x=0.000', 'y=0.000', 'depth=0.000', 'file=surface_x=0.000_y=0.000_', 'writeEvery=100', 'variables=velocity']
file=surface_x=0.000_y=0.000_
...
pySW4/core/config.py in read_input_file(filename)
31 print line
32 print item
---> 33 key, value = item.split("=")
34 config_item[key] = _decode_string_value(value)
35 config_category.append(config_item)
ValueError: too many values to unpack
Now it is doing what I thought it was doing in the first place... So I was right too, well, sort off... ;)
Should be fixed on master now.
Ha! I was just about to commit mine... Thanks though.
Ooops, sorry.. :blush:
This happens because some of the station names have
=
signs in them. For some purposes this is important and I don't want to limit the user from using that... I'll take care of this later to make it more robust.