-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Decimal is not JSON serializable when submitting job #29
Comments
This is an incompatibility between the Is it straightforward for you to convert any instances of Decimal to int before sending to Zencoder? In this case from decimal import Decimal
from zencoder import Zencoder
client = Zencoder('API_KEY')
client.job.create('s3://bucket/key.mp4',
outputs=[{'width': int(Decimal(300))}]) |
Also, it looks like boto can be configured to return ints and floats: http://boto.readthedocs.org/en/latest/ref/dynamodb.html#boto.dynamodb.layer2.Layer2.use_decimals |
It looks like that configuration will only work when using I can (and probably will) write some code to cast |
Fair enough - back when I was first working on the tool there was a specific reason I picked the Here's where we pick the json module to import: |
Just put together a quick PR that makes this configurable: #30 Please check it out and let me know if it will work for you. Thanks! |
Sorry it's taken so long, but this looks like it solves the problem, albeit a little awkwardly. The
It'd be preferable if this environment variable were read when making use of the
…but then you start getting into a dependency injection situation, which as far as I understand it can get tricky pretty quickly in Python. |
Gotcha - the way this was intended to be used is that you'd set If you do it that way, there is no need to edit the |
Yes, we'll be able to set that environment variable. |
Decimals aren't handled in
client.job.create
.…causes:
I'm retrieving job settings from DynamoDB with
boto
andsimplejson
which seems to like returning numbers as Decimals.The text was updated successfully, but these errors were encountered: