DiamondLightSource / DiamondLightSource/ispyb-api

Robustness to incorrect types; numpy.int64 cannot be converted

Open
#115 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
7
Forks
11
PR merge metrics
No merged PRs in 30d

Description

Spent some time tracking down an annoying calling error:
```
Traceback (most recent call last):
File "i24ssx_Chip_Collect_py3v1.py", line 293, in create_dcid
dcid = conn.mx_acquisition.upsert_data_collection(list(dc_params.values()))
File ".../site-packages/ispyb/sp/acquisition.py", line 166, in upsert_data_collection
return self.get_connection().call_sp_write("upsert_dc", values)
File ".../site-packages/ispyb/connector/mysqlsp/main.py", line 88, in call_sp_write
result_args = cursor.callproc(procname=procname, args=args)
File ".../site-packages/mysql/connector/cursor_cext.py", line 466, in callproc
"Failed calling stored routine; {0}".format(err))
mysql.connector.errors.InterfaceError: Failed calling stored routine; Python type numpy.int64 cannot be converted
```
Calling API had provided a `numpy.int64` instead of an int. This looks like an int in `__str__` and `__repr__` so took an annoyingly long time to track down. I wonder if it'd be possible to tell which value caused this error, at least.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.