Getting Python error “from: can't read /var/mail/Bio”

后端 未结 6 1961
长发绾君心
长发绾君心 2020-12-24 11:42

I am running a (bio)python script which results in the following error:

from: can\'t read /var/mail/Bio

seeing as my script doesn\'t have a

6条回答
  •  不思量自难忘°
    2020-12-24 11:55

    No, it's not the script, it's the fact that your script is not executed by Python at all. If your script is stored in a file named script.py, you have to execute it as python script.py, otherwise the default shell will execute it and it will bail out at the from keyword. (Incidentally, from is the name of a command line utility which prints names of those who have sent mail to the given username, so that's why it tries to access the mailboxes).

    Another possibility is to add the following line to the top of the script:

    #!/usr/bin/env python
    

    This will instruct your shell to execute the script via python instead of trying to interpret it on its own.

提交回复
热议问题