-1

I tryed to use the sh command but i always get command not found in line x errors. I am using a Red Hat enterprise and i am opening a Nagios plugin programmed with python.

Error: check_fileage.py: line 3: import: command not found

Zhunder
  • 73
  • 2
  • 12
  • Does the file have a shebang? Have you tried `python check_fileage.py`? – jonrsharpe Aug 19 '15 at 08:08
  • Try looking at any tutorial. – muddyfish Aug 19 '15 at 08:08
  • Executable text files in Linux are _assumed_ to be shell if they do not have what's called a "shebang", that directs the OS to use some other interpreter. You need `#! /usr/bin/env python` (optionally `python2.7` or `python3` etc) on the very first line in order to cause Linux to use Python to execute that script. – mdaniel Aug 19 '15 at 08:09
  • Im pretty new to linux but python check_fileage.py helped me out thx :) – Zhunder Aug 19 '15 at 08:15

1 Answers1

1

Use python pythonFile.py from your bash shell i.e. from the terminal

Joseph
  • 789
  • 1
  • 9
  • 23