master
Desai, Kartikey H 2019-01-09 08:36:10 -05:00
parent 06e23b08b8
commit 7883614d2f
1 changed files with 2 additions and 2 deletions

View File

@ -15,7 +15,7 @@ import six
from stix2 import v20, v21
from stix2.base import _STIXBase
from stix2.core import parse
from stix2.datastore import DataSink, DataSource, DataStoreMixin
from stix2.datastore import DataSink, DataSource, DataStoreMixin, DataSourceError
from stix2.datastore.filters import Filter, FilterSet, apply_common_filters
from stix2.utils import format_datetime, get_type_from_id, is_marking
@ -546,7 +546,7 @@ class FileSystemSink(DataSink):
# TODO: Better handling of the overwriting case.
if os.path.isfile(file_path):
print("Attempted to overwrite file!", file_path, file=sys.stderr)
raise DataSourceError("Attempted to overwrite file (!) at: {}".format(file_path))
else:
with io.open(file_path, 'w', encoding=encoding) as f:
stix_obj = stix_obj.serialize(pretty=True, encoding=encoding, ensure_ascii=False)