Telegraf plugin error for py script

Hi team ,

I am trying to scedule a conf file from telegraf were i am trying to execute a py script
however i am getting error "Error in plugin: exec: fork/exec /etc/telegraf/telegraf.d/ exec format error for command ‘/etc/telegraf/telegraf.d/’: "

the code is very simple i am trying to fetch a value from an API get call
and want to use to print it in influx

import requests
import json

url = “https://##########:443/api/v1/Queues(‘EUHUB_JMS_Queue_v1’)?$format=json”

payload = {}
headers = {


response = requests.request(“GET”, url, headers=headers, data=payload)

resp = json.loads(response.text)
nomsgs1 = mydata[‘d’][‘NumbOfMsgs’]
tenant = “r0121”

print “EU_HUB_messages,tenant=” + tenant+" total=" + str(nomsgs1)

can you help me here what i am missing and the format for printing in telegraf