Python state script gives `exec format error`

Hey,
I understood that I can write state scripts in python as long as it has the shebang on the top line. So, first question: is that correct?

Mine starts with :

#!/usr/bin/python3

import subprocess
import time
import re
import json
import os
import logging
from contextlib import contextmanager

...

Unfortunately I’m running into:

`‘ArtifactReboot_Leave_01_fix_readonly_paths.py’: -1 : fork/exec /var/lib/mender/scripts/ArtifactReboot_Leave_01_fix_readonly_paths.py:

When I execute the script manually by using standalone mender client it works fine. Any ideas? Is the .py ending an issue? Should I have a shell script that call the python script?

Thanks in advance!