QuestionQ26

Creation of Executables

A programmer tries to execute the Python program hello.py as shown, but an error results. What causes this error?

Question Image

  • A hello.py is missing the line #!usr/bin/python
  • B smtp_mime was replaced with Python
  • C Python cannot find the script ג€helloג€
  • D hello.py is improperly encoded with UTF-16le
Explanation

An executable Python source file needs a shebang that identifies the Python interpreter, such as #!/usr/bin/python or #!/usr/bin/env python3, when it is run directly as ./hello.py. Without one, the operating system does not know to launch Python and may attempt to process the source as a shell command instead.

Community Discussion

No comments yet. Be the first to start the discussion!