Python syntax error because of version conflicts

0 votes

I found a python script on the internet and try to run it like this

python py-exmple.py

I get this error:

File "py-exmple.py", line 93

    print json.dumps(evaluate(), indent=4)

             ^

SyntaxError: invalid syntax

I have python installed.

Aug 13, 2018 in Blockchain by digger
• 26,740 points
936 views

2 answers to this question.

0 votes
Hey, please mention the version of python you are using.
answered Aug 13, 2018 by Omkar
• 69,210 points
I am using version 3.6.5
0 votes

As mentioned in the reply to my question, you are using version 3.6.5. 

In python 3.x, you have to add braces for your code.

Change your code to this syntax and it will work.

print( json.dumps(evaluate(), indent=4) )
answered Aug 13, 2018 by Omkar
• 69,210 points

Related Questions In Blockchain

0 votes
1 answer

Blockchain Python Syntax Error

Look here:  print('Block #{} has been added to ...READ MORE

answered Jul 13, 2018 in Blockchain by Christine
• 15,790 points
704 views
0 votes
1 answer

Syntax Error running on Python

You are missing the closing parenthesis: hashlib.sha256(self.index + ...READ MORE

answered Sep 21, 2018 in Blockchain by digger
• 26,740 points
359 views
0 votes
1 answer

Web3j v3.3.1 : Error while generating compiled solidity smart contracts which returns array of struct

Solidity does not support returning structs in ...READ MORE

answered Jun 19, 2018 in Blockchain by aryya
• 7,450 points
1,394 views
0 votes
1 answer

How to solve “More than one instance of bitcore-lib found” error?

There is a temp solution here. ~/bitcore-explorers/node_modules/bitcore-lib/index.js line 7: bitcore.versionGuard ...READ MORE

answered Jul 25, 2018 in Blockchain by slayer
• 29,350 points
2,438 views
+2 votes
1 answer
0 votes
1 answer

Python request module for bitcoin json rpc

This should work: #!/usr/bin/env python import getpass import json import requests ...READ MORE

answered Aug 28, 2018 in Blockchain by digger
• 26,740 points
2,172 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,663 views
0 votes
1 answer

Ethereum generating genesis Python Syntax

print in python3 is a method not a ...READ MORE

answered Oct 10, 2018 in Blockchain by Omkar
• 69,210 points
632 views
0 votes
1 answer

Blockchain: Installing an earlier version of ethereum using apt-get on

geth does not make the previous version available ...READ MORE

answered Oct 10, 2018 in Blockchain by Omkar
• 69,210 points
1,101 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