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

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!