Event Timeline
Comment Actions
(Pdb++) origins_[0] ListedOrigin(lister_id=UUID('31fd49a6-396e-473e-8522-ed105b48b5d9'), url='https://repo1.maven.org/maven2/al/aldi/sprova4j/0.1.0/sprova4j-0.1.0-sources.jar', visit_type='maven', extra_loader_arguments={'artifacts': [{'time': '2021-07-12T17:06:59+00:00', 'gid': 'al.aldi', 'aid': 'sprova4j', 'version': '0.1.0', 'base_url': 'https://repo1.maven.org/maven2/'}]}, last_update=datetime.datetime(2021, 7, 12, 17, 6, 59), enabled=True, first_seen=None, last_seen=None) (Pdb++) origins_[0].last_update datetime.datetime(2021, 7, 12, 17, 6, 59) (Pdb++) self.send_origins(origins_) *** ValueError: can not serialize 'datetime.datetime' object where tzinfo=None Traceback (most recent call last): File "/src/swh-lister/swh/lister/pattern.py", line 236, in send_origins ret = self.scheduler.record_listed_origins(batch_origins) File "/srv/softwareheritage/venv/lib/python3.7/site-packages/swh/core/api/__init__.py", line 181, in meth_ return self.post(meth._endpoint_path, post_data) File "/srv/softwareheritage/venv/lib/python3.7/site-packages/swh/core/api/__init__.py", line 262, in post data = self._encode_data(data) File "/srv/softwareheritage/venv/lib/python3.7/site-packages/swh/core/api/__init__.py", line 281, in _encode_data return encode_data(data, extra_encoders=self.extra_type_encoders) File "/srv/softwareheritage/venv/lib/python3.7/site-packages/swh/core/api/serializers.py", line 126, in encode_data_client return msgpack_dumps(data, extra_encoders=extra_encoders) File "/srv/softwareheritage/venv/lib/python3.7/site-packages/swh/core/api/serializers.py", line 275, in msgpack_dumps default=encode_types, File "/srv/softwareheritage/venv/lib/python3.7/site-packages/msgpack/__init__.py", line 35, in packb return Packer(**kwargs).pack(o) File "msgpack/_packer.pyx", line 294, in msgpack._cmsgpack.Packer.pack File "msgpack/_packer.pyx", line 300, in msgpack._cmsgpack.Packer.pack File "msgpack/_packer.pyx", line 297, in msgpack._cmsgpack.Packer.pack File "msgpack/_packer.pyx", line 231, in msgpack._cmsgpack.Packer._pack File "msgpack/_packer.pyx", line 264, in msgpack._cmsgpack.Packer._pack File "msgpack/_packer.pyx", line 231, in msgpack._cmsgpack.Packer._pack File "msgpack/_packer.pyx", line 231, in msgpack._cmsgpack.Packer._pack File "msgpack/_packer.pyx", line 289, in msgpack._cmsgpack.Packer._pack (Pdb++) origin = origins_[0] (Pdb++) origin ListedOrigin(lister_id=UUID('31fd49a6-396e-473e-8522-ed105b48b5d9'), url='https://repo1.maven.org/maven2/al/aldi/sprova4j/0.1.0/sprova4j-0.1.0-sources.jar', visit_type='maven', extra_loader_arguments={'artifacts': [{'time': '2021-07-12T17:06:59+00:00', 'gid': 'al.aldi', 'aid': 'sprova4j', 'version': '0.1.0', 'base_url': 'https://repo1.maven.org/maven2/'}]}, last_update=datetime.datetime(2021, 7, 12, 17, 6, 59), enabled=True, first_seen=None, last_seen=None) (Pdb++) last_update = origin.last_update (Pdb++) last_update datetime.datetime(2021, 7, 12, 17, 6, 59) (Pdb++) last_update.replace last_update.replace (Pdb++) last_update.replace(tzinfo=timezone.utc) *** NameError: name 'timezone' is not defined (Pdb++) from datetime import timezone (Pdb++) last_update.replace(tzinfo=timezone.utc) datetime.datetime(2021, 7, 12, 17, 6, 59, tzinfo=datetime.timezone.utc) (Pdb++) origin=attr.evolve(origin, last_update=last_update.replace(tzinfo=timezone.utc)) *** NameError: name 'attr' is not defined (Pdb++) import attr (Pdb++) origin=attr.evolve(origin, last_update=last_update.replace(tzinfo=timezone.utc)) (Pdb++) origin ListedOrigin(lister_id=UUID('31fd49a6-396e-473e-8522-ed105b48b5d9'), url='https://repo1.maven.org/maven2/al/aldi/sprova4j/0.1.0/sprova4j-0.1.0-sources.jar', visit_type='maven', extra_loader_arguments={'artifacts': [{'time': '2021-07-12T17:06:59+00:00', 'gid': 'al.aldi', 'aid': 'sprova4j', 'version': '0.1.0', 'base_url': 'https://repo1.maven.org/maven2/'}]}, last_update=datetime.datetime(2021, 7, 12, 17, 6, 59, tzinfo=datetime.timezone.utc), enabled=True, first_seen=None, last_seen=None) (Pdb++) self.send_origins([origin]) 1
So we need to add the tzinfo to those datetime.