Merge pull request #257 from Carton/1.7
fix ValueError when converting empty string KM to float in sgf parser
This commit is contained in:
1 file changed
+6
-1
@@ -192,7 +192,12 @@ class SGFNode:
|
|||||||
@property
|
@property
|
||||||
def komi(self) -> float:
|
def komi(self) -> float:
|
||||||
"""Retrieves the root's KM property, or 6.5 if missing"""
|
"""Retrieves the root's KM property, or 6.5 if missing"""
|
||||||
return float(self.root.get_property("KM", 6.5))
|
try:
|
||||||
|
km = float(self.root.get_property("KM", 6.5))
|
||||||
|
except ValueError:
|
||||||
|
km = 6.5
|
||||||
|
|
||||||
|
return km
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ruleset(self) -> str:
|
def ruleset(self) -> str:
|
||||||
|
|||||||
Reference in new issue
Block a user