开发者

Python ImportError (Cannot import name Variables)

开发者 https://www.devze.com 2023-03-05 18:55 出处:网络
I have done some research on this question and nothing seems to fix it, I suspect I may be accidentally circularly importing somewhere, but this one has stumped me.

I have done some research on this question and nothing seems to fix it, I suspect I may be accidentally circularly importing somewhere, but this one has stumped me.

This package is a Python IRC Service framework. The issue occurs when dynamically loading a module (via imp.load_source()), and the new module tries to import something from the src folder (Variables.py). It fails with "Cannot import name Variables", yet, it imports another module from the same directory without complaint.

Here is the specific error:

**ERROR: ModLoad(): Unable to load module /home/sam/workspace/Affinity/bin/../modules/ircd_affinity.py: cannot import name Variables **

This is the full file for modules/ircd_affinity.py: ircd_affinity.py, and src/Variables.py: Variables.py

If it helps. browse the entire repository... this (https://github.com/miniCruzer/Affinity/blob/master/src/Affinity.py) module (starting at line 123) loads modules.

I would appreciate if all respons开发者_运维问答es were kept relevant to the specific issue at hand. Yes, it may be tempting to suggest other things I'm doing wrong or otherwise throughout the entire package - I am welcome to suggestions: please e-mail them to me.


Show the full traceback. Look through it for evidence of (attempted) circular import.

Run Python with the -v option ... what does that tell you?

Look at the contents of sys.path and sys.modules just before the error happens.

"**ERROR: ModLoad(): Unable to ..." doesn't look line a Python-raised error. Is that in your code? If so, dig deeper; why is it raised?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号