Not able to execute python script using execd processor

I am running telegraf as a docker container. I wanted to run a python script, for that i am using processors.execd plugin, but docker logs is showing exec format error.

My telegraf config file:

[[processors.execd]]
command = ["/etc/telegraf/cpu.py"]

[[inputs.file]]
files=["/etc/telegraf/input.json"]
data_format = “json”

json_strict = true

##fieldpass = [“counters_"]
json_time_key = “beginTime”
json_time_format = “unix”
tag_keys = [
“swVersion”,
“GNBID”,
“senderType”,
“VNFID”,
“GNBNAME”,
“granPeriod”
]
json_string_fields = ["counters_
”]
name_override = “data1”

Docker-logs:

Any solution would be helpful. Thanks

Thanks for the question. exec format error in my experience suggests running a 64-bit binary on a 32-bit system, or an armhf binary on x86 or similar mis-match. What’s the first line of your /etc/telegraf/cpu.py? Typically it might be something like #!/usr/bin/env python or similar.

Thanks that line worked for me. But now its showed - permission denied. Earlier the python script was in etc/telegraf folder so i moved to tmp folder and then tried, still no results. Then i tried to run using sudo -

[[processors.execd]]
command = [“sudo”,“tmp/cpu.py”]

I am getting the error -

Conventional (standard) placement for your script would be somewhere like /usr/local/bin. Does the script need root privs when run as a normal user such as yourself, in a terminal? If it indeed needs sudo, then you’ll likely need to specify the path to the sudo binary, as the environment (PATH) may not be setup correctly via execd. sudo typically lives somewhere like /usr/bin/sudo. You may also need to configure sudo so it doesn’t ask for a password (which is the typically default behaviour) otherwise your execd call will hang as sudo waits for a password to run the script. But as I say, if it runs fine as you, from /usr/local/bin then you may not even need sudo?