added automatic chmod 666 for list

cleanup
m455 2018-08-07 13:40:41 -04:00
parent 456bf1fb80
commit 9ee24365c5
1 changed files with 8 additions and 7 deletions

View File

@ -20,18 +20,19 @@ messages = {'list_created': "{} created, try your command again and it should wo
'too_many_args': "sorry, i only accept one argument.\ntry using:\n{} \"your message here\"".format(program_name), 'too_many_args': "sorry, i only accept one argument.\ntry using:\n{} \"your message here\"".format(program_name),
'file_not_found': "{} doesn't exist\ndo you want me to make a {} file right now? (y/n)".format(the_list, the_list)} 'file_not_found': "{} doesn't exist\ndo you want me to make a {} file right now? (y/n)".format(the_list, the_list)}
def write_to_file(list_file, content): def write_to_file(a_file, content):
temp = open(list_file, 'a') temp = open(a_file, 'a')
temp.write(content) temp.write(content)
temp.close() temp.close()
def create_file(list_file): def create_file(a_file):
open(list_file, 'a').close() open(a_file, 'a').close()
os.chmod(the_list, 0o666)
print(messages['list_created']) print(messages['list_created'])
def show_random_line(list_file): def show_random_line(a_file):
thefile = open(list_file, 'r').read(1) thefile = open(a_file, 'r').read(1)
temp = open(list_file, 'r') temp = open(a_file, 'r')
contents = temp.read(1) contents = temp.read(1)
if not contents: if not contents:
print(messages['list_empty']) print(messages['list_empty'])