question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ImportError: cannot import name 'compile_solidity'

See original GitHub issue

Hi, I am getting errors while running the analysis.py from here. it seems like the compile_solidity method has been removed from the util package. Is there a workaround ?

here is the error i’m getting.

Traceback (most recent call last):
  File "analysis.py", line 3, in <module>
    from mythril.ether.util import compile_solidity
ImportError: cannot import name 'compile_solidity'

Thanks

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
muellerberndtcommented, May 24, 2018

@bishesh16 you’re right, the interface has changed since I wrote that article. For example, to compile a Solidity file and execute the bytecode symbolically you’d now do:

from mythril.ether.soliditycontract import SolidityContract
from mythril.analysis.symbolic import SymExecWrapper
from mythril.ether import util

contract = SolidityContract(filename)
sym = SymExecWrapper(contract, util.get_indexed_address(0))

There’s changes in how state is represented as well, so the old script is pretty useless. I’ll update it when I find some time & we’re also planning to write better documentation on the various classes (contributions are welcome of course 😃)

0reactions
JoranHonigcommented, May 29, 2018

It seems like your question is answered now, nice! @bishesh16 if you have any questions you can always hop by on our gitter channel https://gitter.im/ConsenSys/mythril

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot import name MockV3Aggregator #294 - GitHub
When I try to run deploy.py I get the error ImportError: cannot import name 'MockV3Aggregator' from 'brownie' (C:\Users\Larry ...
Read more >
cannot import name 'MockV3Aggregator' from 'brownie ...
I am learning Solidity at the moment and I ...
Read more >
can't import module from solidity file to python file in brownie
can't import module from solidity file to python file in brownie; ImportError: cannot import name 'AdvancedCollectible' from 'brownie'.
Read more >
How to Fix : “ImportError: Cannot import name X” in Python
The following are the major reasons for the occurrence of "ImportError: cannot import name": The imported class is in a circular dependency.
Read more >
Import Path Resolution — Solidity 0.8.17 documentation
An import callback is free to interpret source unit names in an arbitrary way, not just as paths. If there is no callback...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found