Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

python

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 anything to with mail, I don't understand why my script is looking in /var/mail.

What seems to be the problem here? i doubt it will help as the script doesn't seem to be the problem, but here's my script anyway:

from Bio import SeqIO from Bio.SeqUtils import ProtParam  handle = open("examplefasta.fasta")  for record in SeqIO.parse(handle, "fasta"):      seq = str(record.seq)     X = ProtParam.ProteinAnalysis(seq)     print X.count_amino_acids()      print X.get_amino_acids_percent()      print X.molecular_weight()      print X.aromaticity()      print X.instability_index()      print X.flexibility()      print X.isoelectric_point()      print X.secondary_structure_fraction() 

what is the problem here? bad python setup? I really don't think it's the script.

like image 412
brucezepplin Avatar asked Apr 17 '13 20:04

brucezepplin


1 Answers

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.

like image 99
Tamás Avatar answered Sep 30 '22 12:09

Tamás