I created class method to ease file reading. But the end result gives me the following error message:
TypeError: Read_file.file_reading_through_class() missing 1 required positional argument: 'fileName'
My code is below:
import pandas as pd
import sys,os, time,re
class Read_file():
def file_reading_through_class(self,fileName):
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
path_actual = os.getcwd()
path_main_folder = path_actual[:-4]
path_result = path_main_folder + fileName
print('frozen path', os.path.normpath(path_result))
file_to_read = pd.read_json(path_result)
return file_to_read
else:
file_to_read = pd.read_json(fileName)
return file_to_read
file_read=Read_file.file_reading_through_class('./ConfigurationFile/configFile.csv')