diff --git a/plaso/engine/engine.py b/plaso/engine/engine.py index 81ee912d0c..9f18bc69ba 100644 --- a/plaso/engine/engine.py +++ b/plaso/engine/engine.py @@ -354,7 +354,9 @@ def PreprocessSource( system_configuration = artifacts.SystemConfigurationArtifact( code_page=mediator.code_page, language=mediator.language) - system_configuration.environment_variables = ( + # Ensure environment_variables is a list otherwise serialization will + # fail. + system_configuration.environment_variables = list( mediator.GetEnvironmentVariables()) system_configuration.hostname = mediator.hostname system_configuration.keyboard_layout = mediator.GetValue( diff --git a/plaso/storage/sqlite/sqlite_file.py b/plaso/storage/sqlite/sqlite_file.py index 42ea9bc32e..085c7270d0 100644 --- a/plaso/storage/sqlite/sqlite_file.py +++ b/plaso/storage/sqlite/sqlite_file.py @@ -241,7 +241,13 @@ def _SerializeAttributeContainer(self, container): json_dict['_event_data_stream_identifier'] = ( event_data_stream_identifier.CopyToString()) - serialized_string = json.dumps(json_dict) + try: + serialized_string = json.dumps(json_dict) + except TypeError as exception: + raise IOError(( + 'Unable to serialize attribute container: {0:s} with error: ' + '{1!s}.').format(container.CONTAINER_TYPE, exception)) + if not serialized_string: raise IOError('Unable to serialize attribute container: {0:s}.'.format( container.CONTAINER_TYPE))