This is a test version of Biostars. For the public version, visit https://www.biostars.org.
"SyntaxError: unexpected EOF while parsing " IN PYTHON 3.7

E_VALUE_THRESH = 0.04

for alignment in b_record.alignments:
    for hsp in alignment.hsps:
        if hsp.expect < E_VALUE_THRESH:
            print '****Alignment****'
            print 'sequence:', alignment.title
            print 'length:', alignment.length
            print 'e value:', hsp.expect
            print hsp.query[0:75] + '...'
            print hsp.match[0:75] + '...'
            print hsp.sbjct[0:75] + '...'

[PYTHON 3.7] THIS OCCUR NOT ONLY IN CASE OF THIS CODE. HAPPENS FREQUENTLY WHENEVER I AM EXECUTING FOR , WHILE LOOP IN THE PROGRAM

python

If you're running this in Py3.x, you need to use print("xyz") with the brackets (and its generally a good idea to do that anyway).

1 answer

The SyntaxError: unexpected EOF while parsing means that the end of your source code was reached before all code blocks were completed. A Python code block starts with a statement like for i in range(100): and requires at least one line afterwards that contains code that should be in it.

Also, this can simply mean you are missing or have too many parenthesis. For example this has too many, and will result in unexpected EOF.

Log in to answer this question.