''' 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
私は得ています:
ImportError: パスという名前のモジュールがありません
ファイル「pyclasspath /Lib/Testdata.py」の 2 行目
os.path は、プロジェクトの他のすべてのクラスで機能しています。誰かが私がやっている間違いを指摘できますか?
このファイルをあるディレクトリから別のディレクトリに移動しました。それ以外は、このクラスと他のクラスに違いはありません。