I get the same error when I try to reload a file after switching folders.
For instance:
Create a simple module:
In [10]: %%file temp.py ...: message = "Hello World!" ...: Writing temp.py
Download the module and print the message:
In [14]: import temp ...: print(temp.message) Hello World!
Change the message:
In [17]: temp.message = 'Hello brave new world!' ...: print(temp.message) Hello brave new world!
Reboot the module to return the original message:
In [18]: import imp ...: imp.reload(temp) ...: print(temp.message) Hello World!
Everything is fine so far ...
Now change the paths:
In [20]: cd ..
Try reloading the module:
In [24]: imp.reload(temp) Traceback (most recent call last): File "<ipython-input-24-7fa95de0f250>", line 1, in <module> imp.reload(temp) File "/home/user/anaconda3/lib/python3.4/imp.py", line 315, in reload return importlib.reload(module) File "/home/user/anaconda3/lib/python3.4/importlib/__init__.py", line 149, in reload methods.exec(module) File "<frozen importlib._bootstrap>", line 1134, in exec AttributeError: 'NoneType' object has no attribute 'name'
In my case, the solution was to get back to the path in which the import was made initially.
source share