Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

又见 No module named 'xxx' #189

Closed
h25302 opened this issue Aug 15, 2021 · 8 comments
Closed

又见 No module named 'xxx' #189

h25302 opened this issue Aug 15, 2021 · 8 comments

Comments

@h25302
Copy link

h25302 commented Aug 15, 2021

之前出过类似毛病:#164 ,并且在0.5.4版本中已解决。
今天升级0.5.6版本,在使用 aerich init-db时,又出现错误:

Error: Error while importing configuration module: No module named 'xxx'

经过跟踪分析,发现在utils.py文件第66行 importlib.import_module(config_path) 之前并未在sys.path加入配置目录

在cli.py文件第73行之前插入以下代码可解:

add_src_path(src_folder)

并且在ini配置文件中已加入配置: src_folder = ./.

我自己是暂时这样解决,不知道算不算BUG,望 @long2ice 尽快看下

@h25302
Copy link
Author

h25302 commented Aug 15, 2021

不太懂如何才能贡献代码,只能发文字了,抱歉抱歉 @long2ice

@h25302
Copy link
Author

h25302 commented Aug 15, 2021

72        src_folder = parser[name].get("src_folder", CONFIG_DEFAULT_VALUES["src_folder"])
73        add_src_path(src_folder)         <-----------------增加这一行
74        tortoise_config = get_tortoise_config(ctx, tortoise_orm)

@long2ice
Copy link
Member

是哪一个命令?我这边测试没这个问题

@h25302
Copy link
Author

h25302 commented Aug 16, 2021

是哪一个命令?我这边测试没这个问题

#188 里所出现的应该也是这个问题

我昨天试过 aerich init-db、aerich history都有问题,估计别的命令应该也有问题的

另外说下,我的环境也是windows的,不清楚是不是跟操作系统有关,没有具体分析
只是在 #188 中,楼主也是win环境

@long2ice
Copy link
Member

已修复,安装最新源码试试

@injectionsuccesfully
Copy link

Please refresh pypi (module not found)

@h25302
Copy link
Author

h25302 commented Aug 17, 2021

pip install git+https://github.com/tortoise/aerich.git@dev

安装dev版本后,测试了history、init-db、migrate,都已正常执行了。

@long2ice
Copy link
Member

released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants