Run a python script on redhat 7.4 [duplicate]

0

Good morning, fellows

I made a script to integrate the telegram to zabbix and forward the incidents.

The Problem, the script is executed at the prompt using #python telegram.py

But when I run #. / telegram it gives me an error, I transcribe the script below, and right after the execution exit

! / usr / bin / python2

import telebot, sys

BOT_TOKEN = '665333824: AAHTWQAz6dkS1bjpp9REu6RN-YHl_4cnTmU' DESTINATION = sys.argv [1] SUBJECT = sys.argv [2] MESSAGE = sys.argv [3]

MESSAGE = MESSAGE.replace ('/ n', '\ n')

tb = telebot.TeleBot (BOT_TOKEN)

tb.send_message (DESTINATION, SUBJECT + '\ n' + MESSAGE)

xxx@zabbix:./telegram
./telegram: line 7: import: comando não encontrado
./telegram: line 14: erro de sintaxe próximo do 'token' não esperado '('
./telegram: line 14: 'MESSAGE = MESSAGE.replace('/n','\n')'

From what I'm seeing he thinks it's a bash and not a python, how do I stop it from understanding that it's a python?

Thank you for your cooperation and good morning ..

    
asked by anonymous 22.11.2018 / 09:19

0 answers