aboutsummaryrefslogtreecommitdiffstats
path: root/yamlish.py
diff options
context:
space:
mode:
Diffstat (limited to 'yamlish.py')
-rw-r--r--yamlish.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/yamlish.py b/yamlish.py
index 098e03d..fda3f74 100644
--- a/yamlish.py
+++ b/yamlish.py
@@ -172,10 +172,12 @@ def dump(source, destination):
if isinstance(destination, (str, unicode)):
with open(destination, "w") as outf:
dump(source, outf)
- elif isinstance(destination, file):
+ elif getattr(destination, "file"):
yaml.dump(source, destination, encoding="utf-8",
default_flow_style=False, canonical=False,
Dumper=yaml.SafeDumper)
+ else:
+ raise NameError
def dumps(source):
"""