Python ImportError: No module named 'path'
Question: 
    ''' Data class'''
    
    import os.path
    from random import Random
    
    class TestData(object, Random):
    
        def FetchDataFromFile(self, filename):
            """ Open the file as read only """
            myfile = open(os.path.join(os.getcwd(),filename), 'r')
            """ read the information in the file """
            lines = myfile.read()
            ''' Remove the header as this will not be used '''
            header = lines[0] 
            lines.remove(header)
            return lines
    

I am getting:

> ImportError: No module named path
>
> File "**pyclasspath** /Lib/Testdata.py", line 2, in

os.path is working in all other classes in my project. Can someone point me
what mistake i am doing?

I moved this file from one directory to another. Apart from it, there is no
difference between this class and other classes.


Answer: `import os` should work fine instead

    
    
    import os
    from random import Random
    
    class TestData(object, Random):
    
        def FetchDataFromFile(self, filename):
            """ Open the file as read only """
            myfile = open(os.path.join(os.getcwd(),filename), 'r')
            """ read the information in the file """
            lines = myfile.read()
            ''' Remove the header as this will not be used '''
            header = lines[0] 
            lines.remove(header)
            return lines
    

as an asside your method could be

    
    
    def FetchDataFromFile(self, filename):
            """ Open the file as read only """
            return list(open(os.path.join(os.getcwd(),filename), 'r'))[1:]
    

