reportportal / agent-Python-RobotFramework

Robot Framework integration for Report Portal
Apache License 2.0
59 stars 33 forks source link

Getting Error with robot framework listener -Calling method 'log_message' of listener 'robotframework_reportportal.listener' failed: TypeError: Object of type _PresenceSentinel is not JSON serializable #189

Open Akaaav opened 4 months ago

Akaaav commented 4 months ago

Error information TypeError: Object of type _PresenceSentinel is not JSON serializable

[ ERROR ] Calling method 'log_message' of listener 'robotframework_reportportal.listener' failed: TypeError: Object of type _PresenceSentinel is not JSON serializable

Errorstack :

Traceback (most recent call last): File "C:\Users\xxxx\AppData\Local\Programs\Python\Python312\Lib\site-packages\reportportal_client\core\rp_requests.py", line 128, in make return RPResponse(self.session_method(self.url, data=self.data, json=self.json, files=self.files,

File "C:\Users\xxxx\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\sessions.py", line 637, in post
return self.request("POST", url, data=data, json=json, **kwargs)

File "C:\Users\xxxx\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\sessions.py", line 575, in request
prep = self.prepare_request(req)

File "C:\Users\xxxx\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\sessions.py", line 486, in prepare_request p.prepare( File "C:\Users\xxxx\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\models.py", line 371, in prepare
self.prepare_body(data, files, json) File "C:\Users\xxxx\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\models.py", line 511, in prepare_body body = complexjson.dumps(json, allow_nan=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\xxxx\AppData\Local\Programs\Python\Python312\Lib\json__init__.py", line 238, in dumps **kw).encode(obj) ^^^^^^^^^^^ File "C:\Users\xxxx\AppData\Local\Programs\Python\Python312\Lib\json\encoder.py", line 200, in encode chunks = self.iterencode(o, _one_shot=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\xxxx\AppData\Local\Programs\Python\Python312\Lib\json\encoder.py", line 258, in iterencode return _iterencode(o, 0) ^^^^^^^^^^^^^^^^^ File "C:\Users\xxxx\AppData\Local\Programs\Python\Python312\Lib\json\encoder.py", line 180, in default raise TypeError(f'Object of type {o.class.name} '

TypeError: Object of type _PresenceSentinel is not JSON serializable

[ ERROR ] Calling method 'log_message' of listener 'robotframework_reportportal.listener' failed: TypeError: Object of type _PresenceSentinel is not JSON serializable [ WARN ] ReportPortal None request failed

Command passed: py run.py -i tag -v SUT_HOST_IP:x.x.x.x -L TRACE --listener robotframework_reportportal.listener -v RP_ENDPOINT:"https://hostname" -v RP_API_KEY:"key" -v RP_LAUNCH:"Testing" -v RP_PROJECT:"Test"

Version used:

Python : 3.12.0 Robot framework: 7.0 robotframework-reportportal : 5.5.3 reportportal-client: 5.5.6

HardNorth commented 4 months ago

@Akaaav Usually this means the Agent received not a JSON in response. Most likely it's incorrect configuration, or ReportPortal server issue.

Akaaav commented 4 months ago

I have report portal-UI of version 5.11.0 version and I can manually access portal and it is in a working state.

HardNorth commented 2 weeks ago

@Akaaav You should ensure you are hitting correct API URL and it returns correct answer, you can do this by enabling HTTP logging. Here you can find some methods you might use: https://stackoverflow.com/questions/16337511/log-all-requests-from-the-python-requests-module