Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
339 views
in Technique[技术] by (71.8m points)

python - Why does inspect say that my module is built-in?

mod = importlib.import_module('mortgagecomparison')
inspect.getsourcefile(mod)

Yields:

TypeError: <module 'mortgagecomparison' (namespace)> is a built-in module

But the module is not built-in, it's made by me, then installed a pip install -e ..


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

In the message:

module 'mortgagecomparison' (namespace)

indicates that this is not an imported module or package, just a directory name, presumably without an __init__.py


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...