I am facing a strange error while executing a python code. The following code is a small snippet of the python code I am executing:
#samplecode.py
import time
from datetime import datetime
import sys
import os
import inspect
sys.path.append(os.path.dirname('C:\Users\qksr\Desktop\work\kako\logging.py'))
import logging
from logging import Dynamic
While executing samplecode.py I am facing an error showing the following:
Traceback (most recent call last):
File "C:\Users\qksr\Desktop\work\Fire\samplecode6.py", line 8, in <module>
from logging import Dynamic
ImportError: cannot import name Dynamic
My logging.py which contains the code that needs to be imported while execution. The following is the code:
class Dynamic(object):
pfile3=open('C:\Users\qksr\Desktop\work\sample3.txt','w')
we can see that the class Dynamic is created yet the import error is thrown.
The strangest thing is I did few examples of importing files and it worked well. I have tried hard but still cannot figure it out. I would like to know why this error was thrown and why suddenly for this and not in previous samples?