You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My first try at fixing this was to use this advice for casting a MultiValue object to a list: https://bitbucket.org/openrem/openrem/issues/803
Example: self.modalities_in_study = json.dumps(x)
Into
self.modalities_in_study = json.dumps(list(x))
Now in this example it was (approx. line: 100 inside a try block):
if isinstance(value, pydicom.multival.MultiValue):
couchdb.json.encode(list(value)).encode('utf-8')
else:
couchdb.json.encode(value).encode('utf-8')
This works for a bit but feels hacky. It works until we get to line ~262: doc_id, doc_rev = self.db.save(document)
Then I get the error again:
I've even printed the data to be saved as a document and it's a simple dictionary:
...
I don't feel like I should have to edit "couchdb", "json" or "pydicom" to get this to work. Is there something with record.py that I"m configuring wrong? Could it be our data?
The text was updated successfully, but these errors were encountered:
These are probably issues related to python3 and pydicom 1.x. As I recall the code originally was written against python2.x and pydicom 0.9.x, so maybe one easy workaround would be to install these and try again (they should be pretty easy to find and specify in the paths).
Beyond that, it would be better to fix this code to use the up-to-date packages. The json conversion code from chronicle was actually extracted from here and contributed to the upstream pydicom repository (see pydicom/pydicom#862) and that pull request is where a lot of the porting took places.
Hi,
I'm getting this error when I try to upload my dicom images to couchdb:

"TypeError: Object of type MultiValue is not JSON serializable"
What I've done:
./bin/record.py <path to dicom data>
Offending line:
couchdb.json.encode(value).encode('utf-8')
My first try at fixing this was to use this advice for casting a MultiValue object to a list:
https://bitbucket.org/openrem/openrem/issues/803
Example:
self.modalities_in_study = json.dumps(x)
Into
self.modalities_in_study = json.dumps(list(x))
Now in this example it was (approx. line: 100 inside a try block):
This works for a bit but feels hacky. It works until we get to line ~262:
doc_id, doc_rev = self.db.save(document)
Then I get the error again:

I've even printed the data to be saved as a document and it's a simple dictionary:

...
I don't feel like I should have to edit "couchdb", "json" or "pydicom" to get this to work. Is there something with record.py that I"m configuring wrong? Could it be our data?
The text was updated successfully, but these errors were encountered: