(parent, title, filename, encoding, modal=True, wrap='word',
              _utest=False)
return None
Create text viewer for text in filename.

    Return error message if file cannot be read.  Otherwise calls view_text
    with contents of the file.
Create text viewer for text in filename.
Create text viewer for text in filename .
def view_file(parent, title, filename, encoding, modal=True, wrap='word',
              _utest=False):
    """Create text viewer for text in filename.

    Return error message if file cannot be read.  Otherwise calls view_text
    with contents of the file.
    """
    try:
        with open(filename, 'r', encoding=encoding) as file:
            contents = file.read()
    except OSError:
        showerror(title='File Load Error',
                  message=f'Unable to load file {filename!r} .',
                  parent=parent)
    except UnicodeDecodeError as err:
        showerror(title='Unicode Decode Error',
                  message=str(err),
                  parent=parent)
    else:
        return view_text(parent, title, contents, modal, wrap=wrap,
                         _utest=_utest)
    return None
def view_file ( parent , title , filename , encoding , modal = True , wrap = 'word' , _utest = False ) : try : with open ( filename , 'r' , encoding = encoding ) as file : contents = file . read ( ) except OSError : showerror ( title = 'File Load Error' , message = f'Unable to load file {filename!r} .' , parent = parent ) except UnicodeDecodeError as err : showerror ( title = 'Unicode Decode Error' , message = str ( err ) , parent = parent ) else : return view_text ( parent , title , contents , modal , wrap = wrap , _utest = _utest ) return None