0

I tried running the code below and gave me the error message (bottom of post).


with open("./SimpleStorage.sol", "r") as file:
    simple_storage_file = file.read()
    print(simple_storage_file)

# Compile our Solidity

compiled_sol = compile_standard(
    {
        "language": "Solidity",
        "sources": {"SimpleSotrage.sol": {"content": simple_storage_file}},
        "settings": {
            "outputSelection": {
                "*" : {"*" : ["abi", "metadata", "evm.bytecode", "evm.sourceMap"]}                    
            }
        }
    }    
    solc_version = "0.6.0"
)
print(compiled_sol)

ERROR MESSAGE:

File "deploy.py", line 19
    solc_version = "0.6.0"
               ^
SyntaxError: invalid syntax
jeremyadamananto@Jeremys-MBP web3_py_simple_storage % 

Side note: When installing py-solc-x or checking pip --version, I have to use pip3 instead of pip. Not sure if this may or may not be an issue.

Thanks!

1 Answer 1

0

What you are writing is incorrect JavaScript syntax.

JavasScript objects use : as the notation to make key-value pairs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.