brownie: ModuleNotFoundError: No module named 'Users.t'

This error shows up even if I just run a simple script:

Снимок экрана 2021-10-08 в 01 27 10
t.lolaev@t-lolaev freaky-goblins % brownie run scripts/deploy.py 
Brownie v1.16.4 - Python development framework for Ethereum

FreakyGoblinsProject is the active project.

Launching 'ganache-cli --port 8545 --gasLimit 12000000 --accounts 10 --hardfork istanbul --mnemonic brownie'...
  File "brownie/_cli/run.py", line 49, in main
    return_value, frame = run(
  File "brownie/project/scripts.py", line 53, in run
    module = _import_from_path(script)
  File "brownie/project/scripts.py", line 149, in _import_from_path
    _import_cache[import_str] = importlib.import_module(import_str)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  ...
  File "<frozen, line line, in in
  File "<frozen, line line, in in
ModuleNotFoundError: No module named 'Users.t'
Terminating local RPC client...

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 5
  • Comments: 18

Most upvoted comments

UPD

The problem is that my home directory is called t.lolaev. I solved the problem by moving the project outside of this directory (to the /Users folder)

Please fix this so that other users with a dot in the name of the home directory do not have such problems

@poloxue You just made my day 😄. I posted it a year ago and received a notification now. I’ve left blockchain space but I’m glad I left some important footprints.

Okay, so problem is _import_from_path( ) function.

Refer this discussion for complete details :- https://stackoverflow.com/questions/68721661/eth-brownie-no-module-named-users-someuser/72063674#72063674

I can’t exactly elaborate what’s wrong with the function but all I can say that the condition for “disk partition” is not kept in mind while writing this function. hence, it works fine in linux.

Possible Solution :-

  1. Move your project to the drive where pip install packages. ( C:// drive in my case). It worked for me.
  2. change the code of _import_from_path( ) function as described in stackoverflow’s answer.

Expected help from community :- Please improve this code in subsequent versions of brownie.

@fivetran-connorbrereton, take a look at CountZer0’s change here: https://github.com/eth-brownie/brownie/pull/1446 and try and implement that code change into ur brownie code and retry running things. Not sure if CountZer0’s change will work but it is probably worth a try.

you saved my three day effort. i truly happy now . thank you very very much my respectful bro. 😃)