1 """checktext - Check that a text file has macintosh-style newlines"""
8 pathname
= EasyDialogs
.AskFileForOpen(message
='File to check end-of-lines in:')
11 fp
= open(pathname
, 'rb')
15 EasyDialogs
.Message('Sorry, file is too big.')
18 EasyDialogs
.Message('File is empty.')
20 number_cr
= string
.count(data
, '\r')
21 number_lf
= string
.count(data
, '\n')
22 if number_cr
== number_lf
== 0:
23 EasyDialogs
.Message('File contains no lines.')
25 EasyDialogs
.Message('File has unix-style line endings')
27 EasyDialogs
.Message('File has mac-style line endings')
28 elif number_cr
== number_lf
:
29 EasyDialogs
.Message('File probably has MSDOS-style line endings')
31 EasyDialogs
.Message('File has no recognizable line endings (binary file?)')
34 if __name__
== '__main__':