Skip to content
This repository was archived by the owner on Apr 30, 2024. It is now read-only.

Support Python 3.9 #40

Open
lefjul opened this issue Apr 28, 2022 · 6 comments
Open

Support Python 3.9 #40

lefjul opened this issue Apr 28, 2022 · 6 comments

Comments

@lefjul
Copy link

lefjul commented Apr 28, 2022

With Python 3.9 I get this error when the lambda must remove a record from the hosted zone (when stopping a EC2 instance) :

[ERROR] JSONDecodeError: Expecting value: line 1 column 2402 (char 2401)
Traceback (most recent call last):
  File "/var/task/union_python3.py", line 167, in lambda_handler
    instance = get_item_from_dynamodb_table(dynamodb_client, 'DDNS', instance_id)
  File "/var/task/union_python3.py", line 1069, in get_item_from_dynamodb_table
    return json.loads(item)
  File "/var/lang/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/var/lang/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/var/lang/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None

I don't face any error with Python 3.6 runtime.
Since Python 3.6 will be deprecated in AWS on 18/07/2022, could you please bring the support of Python 3.9 ?

Thanks

@lefjul
Copy link
Author

lefjul commented Apr 28, 2022

I get this error with the python 3.7 runtime as well :

[ERROR] JSONDecodeError: Expecting value: line 1 column 2385 (char 2384)
Traceback (most recent call last):
  File "/var/task/union_python3.py", line 167, in lambda_handler
    instance = get_item_from_dynamodb_table(dynamodb_client, 'DDNS', instance_id)
  File "/var/task/union_python3.py", line 1069, in get_item_from_dynamodb_table
    return json.loads(item)
  File "/var/lang/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/var/lang/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/var/lang/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None

@abjoerne
Copy link

I have not dived into this, but are using a slightly modified version (no reverse lookup zones) of the v3-python-file. It works well with both python 3.6 and 3.9

@lefjul
Copy link
Author

lefjul commented May 27, 2022

To solve this issue I added these 2 lines of code after the line numbered 1067 :

            # BEGIN FIX JSON DECODE
            item = item.replace(" True}", ' "True"}')
            item = item.replace(" False}", ' "False"}')
            # END FIX JSON DECODE

Now it is OK.

@lefjul
Copy link
Author

lefjul commented May 27, 2022

@abjoerne : could please tell me how you modified the code to disable the reverse lookup zones ?
I'm interested in as well,

Thanks,
Lefjul

@abjoerne
Copy link

I just removed all code related to the reverse zones as well as some other adjustments to fit our needs.

@nindza
Copy link

nindza commented Mar 11, 2024

I can confirm @lefjul solution works in Mar/2024 with Python 3.12.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants