call the function io.open with 3 arguments: self.dirpath and thefile joined into a file path, string 'w',
with io . open ( os . path . join ( self . dirpath , thefile ) , "w" , encoding = 'utf-8' ) as fp :