You have a typo in shebang line, which specifies interpreter to use. It should be:
#!/usr/bin/env python
which will default to python2.7. Since you've tagged your question python3, you may want to use:
#!/usr/bin/env python3
You should use the #!/usr/bin/env python3
line .
As it stands now, your shell is interpreting the script with shebang being treated as a comment as it starts with #
. Thus, there's no interpreter specified, and by default script will be executed with your current shell. The shell has no idea of what import
is , hence the command not found error is being shown by the shell.
As a side note, for running native shell commands in python
, use the subprocess
module instead of unsecured and deprecated os.system
function.
Also why are you running user input blindly without any sanity checking?
stat /usr/bin/doors.py
? You may have not set executable permissions for itos.system()
. It's depreciated. Usesubprocess.popen
;
at the end of each line.