Js Push Array Error Handling In Python