We Are Going To Discuss About Python: How to solve bracket not closed error. So lets Start this Python Article.
Python: How to solve bracket not closed error
- How to solve Python: How to solve bracket not closed error
try to replace “=” for “:” I hope this solves the problem.
- Python: How to solve bracket not closed error
try to replace “=” for “:” I hope this solves the problem.
Solution 1
try to replace “=” for “:” I hope this solves the problem.
Original Author adammaly004 Of This Content
Solution 2
As @adammaly004 mentioned, you can’t have an =
in a python dict. Replacing "content" = simple_storage_file
with "content": simple_storage_file
should solve your issue.
Full example:
compiled_sol = compile_standard(
{
"language": "Solidity",
"sources": {"SimpleStorage.sol": {"content": simple_storage_file}}
}
)
Original Author JamesRoberts Of This Content
Solution 3
Thing is you can’t have an “=” in a dict, where you construct it from {}
and not this dict()
Here’s examples of both
1.
compiled_sol = compile_standard(
{
"language": "Solidity",
"sources": {
"SimpleStorage.sol": {
"content": simple_storage_file
}
}
}
)
You cannot use a “=” sign in above constructor
2.
compiled_sol = compile_standard(
dict(
languages="Solidity",
sources = dict(
SimpleStorage.sol = dict(
content = simple_storage_file)
)
)
)
In your case the second method will not work, because you have a .
in SimpleStorage
when you have a .
in something Python thinks it is like a module or class
So that’s why this method won’t work for this case
But it’s handy to know
Original Author Irtiza Babar Of This Content
Conclusion
So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.