How to solve SyntaxError unexpected EOF error in python

+2 votes

I am trying to parse blockchain using python using the following code:

from chainscan import iter_blocks

for block in iter_blocks():

    if block.height > 10: break

    for tx in block.txs:

    print('Hello, tx %s in block %s' % (tx, block))

I am getting this following error:

File "<ipython-input-3-06037b89d550>", line 1

    for block in iter_blocks():

                               ^

SyntaxError: unexpected EOF while parsing

I have checked the code from my reference and there is no problem in the code but it is still not working. How to solve this?

Jul 30, 2018 in Blockchain by digger
• 26,740 points
5,392 views
Hello, how do you solve it? I have the same proble, in miy case occur always, when I use ":", I don´t know if the error is related with the IDe (I'm using Spyder 3.3.6- Phyton 3)
Hey,

Did you try or check the other ways to solve that has been given below?

1 answer to this question.

+2 votes
Best answer

There is not a problem in the code but there is a problem in the indentation.

Use the code with proper indentation like this:

from chainscan import iter_blocks

for block in iter_blocks():

    if block.height > 10: break

    for tx in block.txs:

        print('Hello, tx %s in block %s' % (tx, block))

This should solve your error

answered Jul 30, 2018 by slayer
• 29,370 points

selected May 5, 2019 by Omkar

I am getting the same error for this code:

name ='John'
friend = 'Sharon'
print('Hello %s, this is %s' % (name, friend)

You are missing a parenthesis in your code. The proper code would be:

print('Hello %s, this is %s' % (name, friend))

Related Questions In Blockchain

0 votes
1 answer

How to solve EACCES:permission denied error in Hyperledger Composer?

It seems like there is no required ...READ MORE

answered Jul 11, 2018 in Blockchain by digger
• 26,740 points
2,359 views
0 votes
1 answer

How to solve Runtime error when querying Hyperledger?

OCI is open container initiative.. The error ...READ MORE

answered Jul 9, 2018 in Blockchain by slayer
• 29,370 points
918 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,401 views
0 votes
1 answer

Invalid Batch or signature in Savtooth

This will solve your problem import org.apache.commons.codec.binary.Hex; Transaction txn ...READ MORE

answered Aug 1, 2018 in Blockchain by digger
• 26,740 points
923 views
+1 vote
5 answers

How to solve "truffle: command not found" error in blockchain?

First try restarting the system and then ...READ MORE

answered Jul 16, 2018 in Blockchain by slayer
• 29,370 points
11,851 views
0 votes
1 answer

How to solve "error trying install composer runtime" in Hyperledger composer?

I think the docker-compose tool is not ...READ MORE

answered Jul 17, 2018 in Blockchain by slayer
• 29,370 points
859 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP