You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run the Python script in the 1st Bash Terminal tab's Docker shell
python3 main.py
What was the result of the issue. What the expected behaviour is
In the web3.py Quick Start example code https://github.com/pipermerriam/web3.py, they load the Solidity contract "inline" and store it in variable contract_source_code and then compile the source code with compiled_sol = compile_source(contract_source_code), which is then assigned to the contract_interface = compiled_sol['<stdin>:Greeter'].
But I want to load the Solidity contract from a "file", so I added compile_files to the list of imports from solc import install_solc, compile_source, compile_files and compiled the source code with compiled_sol = compile_files([“./Greeter.sol”]), but I get the following error on the above mentioned line of code that assigns to the contract_interface variable.
Traceback (most recent call last):
File "main.py", line 42, in <module>
contract_interface = compiled_sol['<stdin>:Greeter']
KeyError: '<stdin>:Greeter'
Note: I need to load the Solidity contract from a file so I can implement unit tests.
Cute Animal Picture
The text was updated successfully, but these errors were encountered:
for source, data in contracts.items():
data['abi'] = json.loads(data['abi'])
data['ast'] = sources[source.split(':')[0]]['AST'] # <<<<<
For example - if we use a standard windows filepath as an input (C:\path\to\contract\Greeter.sol:Greeter) a KeyError will be raised when C is used for the lookup. This issue is not unique to windows, and in fact will occur with any filepath containing a colon.
py-solc
Version: 2.1.0 (shown when I runpip3 list
)solc
Version: 0.4.17+commit.bdeb9e52.Linux.g++What was wrong?
How to reproduce the issue
Follow steps in the "Quickstart Guide" of my Github repo https://github.com/ltfschoen/pyethfinality#chapter-0
What was the result of the issue. What the expected behaviour is
In the web3.py Quick Start example code https://github.com/pipermerriam/web3.py, they load the Solidity contract "inline" and store it in variable
contract_source_code
and then compile the source code withcompiled_sol = compile_source(contract_source_code)
, which is then assigned to thecontract_interface = compiled_sol['<stdin>:Greeter']
.But I want to load the Solidity contract from a "file", so I added
compile_files
to the list of importsfrom solc import install_solc, compile_source, compile_files
and compiled the source code withcompiled_sol = compile_files([“./Greeter.sol”])
, but I get the following error on the above mentioned line of code that assigns to thecontract_interface
variable.Note: I need to load the Solidity contract from a file so I can implement unit tests.
Cute Animal Picture
The text was updated successfully, but these errors were encountered: