Issues with connecting cx_oracle with a Python script


I have a Python script that reads from a .sql file and it should execute every command in it. I’m using cx_oracle library to execute the query against the database but am getting the below error,
ORA-24373: Invalid length specified for statement

I’m able to run the same query using sql developer without any issues.