为什么我的用户定义的模块未通过测试脚本找到?
我尝试为我的项目创建用户定义的模块,但我的脚本正在失败。
modulenotfounderror:no模块名为“ config”
我项目的结构就是这样:
Project <Folder>
|
--- Config <Folder>
| |
| --- __init.py__
| --- Config.py
--- Test cases
|
--- Testcase1.py
testcase1.py的内容是
import Config as config
print (config.main_url)
I tried creating the user-defined module for my project but my script is getting failed with an error message
ModuleNotFoundError: No module named 'Config'
The structure of my project is like this:
Project <Folder>
|
--- Config <Folder>
| |
| --- __init.py__
| --- Config.py
--- Test cases
|
--- Testcase1.py
And the content of Testcase1.py is
import Config as config
print (config.main_url)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的用户定义模块应该位于同一目录中。
Your user-defined module should be in the same directory.