ImportError on "" Exercise


I am getting this error. I submitted a bug report but never heard anything.

I get the error even if I “Revert to exercise start” and try submitting.


  ImportError while importing test module ''.
Hint: make sure your test modules.packages have valid Python names.
Traceback: in import_module
    return _bootstrap._gcd_import(name[level:], package, level) in <module>
    from dnd_character import (
E   ImportError: cannot import name 'modifier' from 'dnd_character' (

Could you please post your code here? I suspect something like a typo.

You can keep your post compact by using

This text will be hidden

which will render as


This text will be hidden

I get that error even before adding any code of my own:

class Character:
def init(self):

Something to do with this?


Correct. In this exercise you have to implement a class Character with an initializer (__init__) and a method ability, and also a free function modifier.

More broader, if the tests throws an ImportError complaining it cannot import <name> from <container>, then that container (module, file) is expected to define something with that name.

Ah ok, my ‘modifier’ was a class method.


If it expected a class method and that method was missing, you’d see:

AttributeError: 'Character' object has no attribute 'modifier'
1 Like