diff --git a/blocking.py b/blocking.py index 0fa2080d1..244a9b636 100644 --- a/blocking.py +++ b/blocking.py @@ -554,7 +554,8 @@ def remove_global_block(base_dir: str, os.rename(unblocking_filename + '.new', unblocking_filename) except OSError: - print('EX: unable to rename ' + unblocking_filename) + print('EX: remove_global_block unable to rename ' + + unblocking_filename) return False return True else: @@ -580,7 +581,8 @@ def remove_global_block(base_dir: str, os.rename(unblocking_filename + '.new', unblocking_filename) except OSError: - print('EX: unable to rename 2 ' + unblocking_filename) + print('EX: remove_global_block unable to rename 2 ' + + unblocking_filename) return False return True return False @@ -615,7 +617,8 @@ def remove_block(base_dir: str, nickname: str, domain: str, os.rename(unblocking_filename + '.new', unblocking_filename) except OSError: - print('EX: unable to rename 3 ' + unblocking_filename) + print('EX: remove_block unable to rename 3 ' + + unblocking_filename) return False return True return False @@ -655,7 +658,8 @@ def get_domain_blocklist(base_dir: str) -> str: encoding='utf-8') as fp_blocked: blocked_str += fp_blocked.read() except OSError: - print('EX: unable to read ' + global_blocking_filename) + print('EX: get_domain_blocklist unable to read ' + + global_blocking_filename) return blocked_str @@ -686,7 +690,8 @@ def update_blocked_cache(base_dir: str, blocked_cache.clear() blocked_cache += blocked_lines except OSError as ex: - print('EX: unable to read ' + global_blocking_filename + ' ' + str(ex)) + print('EX: update_blocked_cache unable to read ' + + global_blocking_filename + ' ' + str(ex)) return curr_time @@ -746,8 +751,8 @@ def is_blocked_domain(base_dir: str, domain: str, if search_str_short in blocked_str: return True except OSError as ex: - print('EX: unable to read ' + global_blocking_filename + - ' ' + str(ex)) + print('EX: is_blocked_domain unable to read ' + + global_blocking_filename + ' ' + str(ex)) else: allow_filename = data_dir(base_dir) + '/allowedinstances.txt' # instance allow list @@ -782,8 +787,8 @@ def is_blocked_nickname(base_dir: str, nickname: str, if search_str in blocked_str: return True except OSError as ex: - print('EX: unable to read ' + global_blocking_filename + - ' ' + str(ex)) + print('EX: is_blocked_nickname unable to read ' + + global_blocking_filename + ' ' + str(ex)) return False @@ -1124,12 +1129,14 @@ def outbox_block(base_dir: str, nickname: str, domain: str, return False nickname_blocked = get_nickname_from_actor(message_json['object']) if not nickname_blocked: - print('WARN: unable to find nickname in ' + message_json['object']) + print('WARN: outbox_block unable to find nickname in ' + + message_json['object']) return False domain_blocked, port_blocked = \ get_domain_from_actor(message_json['object']) if not domain_blocked: - print('WARN: unable to find domain in ' + message_json['object']) + print('WARN: outbox_block unable to find domain in ' + + message_json['object']) return False domain_blocked_full = get_full_domain(domain_blocked, port_blocked) @@ -1184,13 +1191,13 @@ def outbox_undo_block(base_dir: str, nickname: str, domain: str, nickname_blocked = \ get_nickname_from_actor(message_json['object']['object']) if not nickname_blocked: - print('WARN: unable to find nickname in ' + + print('WARN: outbox_undo_block unable to find nickname in ' + message_json['object']['object']) return domain_object = message_json['object']['object'] domain_blocked, port_blocked = get_domain_from_actor(domain_object) if not domain_blocked: - print('WARN: unable to find domain in ' + + print('WARN: outbox_undo_block unable to find domain in ' + message_json['object']['object']) return domain_blocked_full = get_full_domain(domain_blocked, port_blocked) @@ -1506,7 +1513,8 @@ def outbox_mute(base_dir: str, http_prefix: str, return nickname_muted = get_nickname_from_actor(message_json['object']) if not nickname_muted: - print('WARN: unable to find nickname in ' + message_json['object']) + print('WARN: outbox_mute unable to find nickname in ' + + message_json['object']) return mute_post(base_dir, nickname, domain, port, @@ -1570,7 +1578,7 @@ def outbox_undo_mute(base_dir: str, http_prefix: str, return nickname_muted = get_nickname_from_actor(message_json['object']['object']) if not nickname_muted: - print('WARN: unable to find nickname in ' + + print('WARN: outbox_undo_mute unable to find nickname in ' + message_json['object']['object']) return diff --git a/blog.py b/blog.py index 371c21049..201346a15 100644 --- a/blog.py +++ b/blog.py @@ -806,7 +806,8 @@ def html_edit_blog(media_instance: bool, translate: {}, with open(dir_str + '/newpost.txt', 'r', encoding='utf-8') as file: edit_blog_text = '
' + file.read() + '
' except OSError: - print('EX: unable to read ' + dir_str + '/newpost.txt') + print('EX: html_edit_blog unable to read ' + + dir_str + '/newpost.txt') css_filename = base_dir + '/epicyon-profile.css' if os.path.isfile(base_dir + '/epicyon.css'): diff --git a/bookmarks.py b/bookmarks.py index 9f2c01cbb..30f8d5571 100644 --- a/bookmarks.py +++ b/bookmarks.py @@ -84,7 +84,8 @@ def undo_bookmarks_collection_entry(recent_posts_cache: {}, encoding='utf-8') as index_file: index_str = index_file.read().replace(bookmark_index + '\n', '') except OSError: - print('EX: unable to read ' + bookmarks_index_filename) + print('EX: undo_bookmarks_collection_entry unable to read ' + + bookmarks_index_filename) if index_str: try: with open(bookmarks_index_filename, 'w+', diff --git a/city.py b/city.py index 9bb0b5364..f54bc26d5 100644 --- a/city.py +++ b/city.py @@ -241,7 +241,7 @@ def spoof_geolocation(base_dir: str, with open(nogo_filename, 'r', encoding='utf-8') as nogo_file: nogo_list = nogo_file.readlines() except OSError: - print('EX: unable to read ' + nogo_filename) + print('EX: spoof_geolocation unable to read ' + nogo_filename) for line in nogo_list: if line.startswith(city + ':'): polygon = parse_nogo_string(line) @@ -338,7 +338,7 @@ def get_spoofed_city(city: str, base_dir: str, city1 = city_file.read() city = remove_eol(city1) except OSError: - print('EX: unable to read ' + city_filename) + print('EX: get_spoofed_city unable to read ' + city_filename) return city diff --git a/content.py b/content.py index b94d040b5..4c20e11b2 100644 --- a/content.py +++ b/content.py @@ -1384,7 +1384,8 @@ def add_html_tags(base_dir: str, http_prefix: str, encoding='utf-8') as foll_file: following = foll_file.readlines() except OSError: - print('EX: unable to read ' + following_filename) + print('EX: add_html_tags unable to read ' + + following_filename) for handle in following: pet = get_pet_name(base_dir, nickname, domain, handle) if pet: @@ -1695,7 +1696,7 @@ def save_media_in_form_post(media_bytes, debug: bool, with open(filename, 'wb') as fp_media: fp_media.write(media_bytes[start_pos:]) except OSError: - print('EX: unable to write media') + print('EX: save_media_in_form_post unable to write media') if not os.path.isfile(filename): print('WARN: Media file could not be written to file: ' + filename) diff --git a/daemon_post_image.py b/daemon_post_image.py index b5611a334..dc22e017a 100644 --- a/daemon_post_image.py +++ b/daemon_post_image.py @@ -71,7 +71,7 @@ def receive_image_attachment(self, length: int, path: str, base_dir: str, with open(media_filename, 'wb') as av_file: av_file.write(media_bytes) except OSError: - print('EX: unable to write ' + media_filename) + print('EX: receive_image_attachment unable to write ' + media_filename) if debug: print('DEBUG: image saved to ' + media_filename) self.send_response(201) diff --git a/daemon_post_newswire.py b/daemon_post_newswire.py index 5a582a77c..dfacbda2b 100644 --- a/daemon_post_newswire.py +++ b/daemon_post_newswire.py @@ -148,7 +148,8 @@ def newswire_update(self, calling_domain: str, cookie: str, encoding='utf-8') as filterfile: filterfile.write(fields['filteredWordsNewswire']) except OSError: - print('EX: unable to write ' + filter_newswire_filename) + print('EX: newswire_update unable to write ' + + filter_newswire_filename) else: if os.path.isfile(filter_newswire_filename): try: @@ -165,7 +166,8 @@ def newswire_update(self, calling_domain: str, cookie: str, encoding='utf-8') as fp_dogwhistles: fp_dogwhistles.write(fields['dogwhistleWords']) except OSError: - print('EX: unable to write ' + dogwhistles_filename) + print('EX: newswire_update unable to write 2 ' + + dogwhistles_filename) self.server.dogwhistles = \ load_dogwhistles(dogwhistles_filename) else: @@ -175,7 +177,8 @@ def newswire_update(self, calling_domain: str, cookie: str, encoding='utf-8') as fp_dogwhistles: fp_dogwhistles.write('') except OSError: - print('EX: unable to write ' + dogwhistles_filename) + print('EX: newswire_update unable unable to write 3 ' + + dogwhistles_filename) self.server.dogwhistles = {} # save news tagging rules @@ -186,7 +189,8 @@ def newswire_update(self, calling_domain: str, cookie: str, encoding='utf-8') as rulesfile: rulesfile.write(fields['hashtagRulesList']) except OSError: - print('EX: unable to write ' + hashtag_rules_filename) + print('EX: newswire_update unable to write 4 ' + + hashtag_rules_filename) else: if os.path.isfile(hashtag_rules_filename): try: @@ -205,7 +209,8 @@ def newswire_update(self, calling_domain: str, cookie: str, encoding='utf-8') as trustfile: trustfile.write(newswire_trusted) except OSError: - print('EX: unable to write ' + newswire_tusted_filename) + print('EX: newswire_update unable to write 5 ' + + newswire_tusted_filename) else: if os.path.isfile(newswire_tusted_filename): try: @@ -311,7 +316,8 @@ def citations_update(self, calling_domain: str, cookie: str, encoding='utf-8') as citfile: citfile.write(citations_str) except OSError: - print('EX: unable to write ' + citations_filename) + print('EX: citations_update unable to write ' + + citations_filename) # redirect back to the default timeline redirect_headers(self, actor_str + '/newblog', diff --git a/daemon_post_person_options.py b/daemon_post_person_options.py index c0c04baf5..2e3e70f4c 100644 --- a/daemon_post_person_options.py +++ b/daemon_post_person_options.py @@ -601,8 +601,8 @@ def _person_options_post_to_news(self, options_confirm_params: str, nofile.write('\n') nw_written = True except OSError as ex: - print('EX: unable to write ' + nw_filename + - ' ' + str(ex)) + print('EX: _person_options_post_to_news unable ' + + 'to write ' + nw_filename + ' ' + str(ex)) if nw_written: refresh_newswire(base_dir) users_path_str = \ @@ -661,7 +661,8 @@ def _person_options_post_to_features(self, options_confirm_params: str, nofile.write('\n') feat_written = True except OSError as ex: - print('EX: unable to write ' + feat_filename + + print('EX: _person_options_post_to_features ' + + 'unable to write ' + feat_filename + ' ' + str(ex)) if feat_written: refresh_newswire(base_dir) @@ -718,7 +719,8 @@ def _person_options_mod_news(self, options_confirm_params: str, encoding='utf-8') as modfile: modfile.write('\n') except OSError: - print('EX: unable to write ' + nw_filename) + print('EX: _person_options_mod_news ' + + 'unable to write ' + nw_filename) users_path_str = \ users_path + '/' + default_timeline + \ '?page=' + str(page_number) diff --git a/follow.py b/follow.py index 7ec24225d..5affef348 100644 --- a/follow.py +++ b/follow.py @@ -354,7 +354,8 @@ def unfollow_account(base_dir: str, nickname: str, domain: str, '!' + handle_to_unfollow_lower): fp_unfoll.write(line) except OSError as ex: - print('EX: unable to write ' + filename + ' ' + str(ex)) + print('EX: unfollow_account unable to write ' + + filename + ' ' + str(ex)) # write to an unfollowed file so that if a follow accept # later arrives then it can be ignored @@ -367,14 +368,16 @@ def unfollow_account(base_dir: str, nickname: str, domain: str, encoding='utf-8') as fp_unfoll: fp_unfoll.write(handle_to_unfollow + '\n') except OSError: - print('EX: unable to append ' + unfollowed_filename) + print('EX: unfollow_account unable to append ' + + unfollowed_filename) else: try: with open(unfollowed_filename, 'w+', encoding='utf-8') as fp_unfoll: fp_unfoll.write(handle_to_unfollow + '\n') except OSError: - print('EX: unable to write ' + unfollowed_filename) + print('EX: unfollow_account unable to write ' + + unfollowed_filename) return True @@ -982,7 +985,8 @@ def send_follow_request(session, base_dir: str, encoding='utf-8') as fp_unfoll: fp_unfoll.write(unfollowed_file) except OSError: - print('EX: unable to write ' + unfollowed_filename) + print('EX: send_follow_request unable to write ' + + unfollowed_filename) new_follow_json = { '@context': 'https://www.w3.org/ns/activitystreams', diff --git a/followingCalendar.py b/followingCalendar.py index 4a115941a..4d66dae8b 100644 --- a/followingCalendar.py +++ b/followingCalendar.py @@ -140,7 +140,8 @@ def _receive_calendar_events(base_dir: str, nickname: str, domain: str, encoding='utf-8') as fp_cal: fp_cal.write(following_handles + handle + '\n') except OSError: - print('EX: unable to write ' + calendar_filename) + print('EX: _receive_calendar_events unable to write ' + + calendar_filename) # already in the calendar file? if handle + '\n' in following_handles or \ diff --git a/happening.py b/happening.py index 902ca81aa..9ad2d107e 100644 --- a/happening.py +++ b/happening.py @@ -158,7 +158,8 @@ def save_event_post(base_dir: str, handle: str, post_id: str, encoding='utf-8') as tl_events_file: tl_events_file.write(event_id + '\n') except OSError: - print('EX: unable to write ' + tl_events_filename) + print('EX: save_event_post unable to write ' + + tl_events_filename) # create a directory for the calendar year if not os.path.isdir(calendar_path + '/' + str(event_year)): @@ -191,7 +192,7 @@ def save_event_post(base_dir: str, handle: str, post_id: str, with open(cal_notify_filename, 'w+', encoding='utf-8') as cal_file: cal_file.write(notify_str) except OSError: - print('EX: unable to write ' + cal_notify_filename) + print('EX: save_event_post unable to write ' + cal_notify_filename) return False return True diff --git a/inbox.py b/inbox.py index 0504a4530..185180ae6 100644 --- a/inbox.py +++ b/inbox.py @@ -426,7 +426,7 @@ def store_hash_tags(base_dir: str, nickname: str, domain: str, tags_file.write(tag_line) hashtag_added = True except OSError: - print('EX: unable to write ' + tags_filename) + print('EX: store_hash_tags unable to write ' + tags_filename) else: content = '' try: @@ -1340,7 +1340,8 @@ def _person_receive_update(base_dir: str, refollow_str = fp_refollow.read() refollow_file_exists = True except OSError: - print('EX: unable to read ' + refollow_filename) + print('EX: _person_receive_update unable to read ' + + refollow_filename) if new_actor not in refollow_str: refollow_type = 'w+' if refollow_file_exists: @@ -1350,7 +1351,7 @@ def _person_receive_update(base_dir: str, encoding='utf-8') as fp_refollow: fp_refollow.write(new_actor + '\n') except OSError: - print('EX: unable to write to ' + + print('EX: _person_receive_update unable to write to ' + refollow_filename) prev_avatar_url = \ get_person_avatar_url(base_dir, person_json['id'], @@ -3704,14 +3705,16 @@ def populate_replies(base_dir: str, http_prefix: str, domain: str, encoding='utf-8') as replies_file: replies_file.write(message_id + '\n') except OSError: - print('EX: unable to append ' + post_replies_filename) + print('EX: populate_replies unable to append ' + + post_replies_filename) else: try: with open(post_replies_filename, 'w+', encoding='utf-8') as replies_file: replies_file.write(message_id + '\n') except OSError: - print('EX: unable to write ' + post_replies_filename) + print('EX: populate_replies unable to write ' + + post_replies_filename) return True @@ -3802,7 +3805,7 @@ def _dm_notify(base_dir: str, handle: str, url: str) -> None: with open(dm_file, 'w+', encoding='utf-8') as fp_dm: fp_dm.write(url) except OSError: - print('EX: unable to write ' + dm_file) + print('EX: _dm_notify unable to write ' + dm_file) def _already_liked(base_dir: str, nickname: str, domain: str, @@ -4020,7 +4023,7 @@ def _notify_post_arrival(base_dir: str, handle: str, url: str) -> None: with open(notify_file, 'w+', encoding='utf-8') as fp_notify: fp_notify.write(url) except OSError: - print('EX: unable to write ' + notify_file) + print('EX: _notify_post_arrival unable to write ' + notify_file) def _reply_notify(base_dir: str, handle: str, url: str) -> None: @@ -4035,7 +4038,7 @@ def _reply_notify(base_dir: str, handle: str, url: str) -> None: with open(reply_file, 'w+', encoding='utf-8') as fp_reply: fp_reply.write(url) except OSError: - print('EX: unable to write ' + reply_file) + print('EX: _reply_notify unable to write ' + reply_file) def _git_patch_notify(base_dir: str, handle: str, subject: str, @@ -4052,7 +4055,7 @@ def _git_patch_notify(base_dir: str, handle: str, subject: str, with open(patch_file, 'w+', encoding='utf-8') as fp_patch: fp_patch.write('git ' + handle + ' ' + subject) except OSError: - print('EX: unable to write ' + patch_file) + print('EX: _git_patch_notify unable to write ' + patch_file) def _group_handle(base_dir: str, handle: str) -> bool: @@ -4305,7 +4308,7 @@ def _update_last_seen(base_dir: str, handle: str, actor: str) -> None: encoding='utf-8') as last_seen_file: last_seen_file.write(str(days_since_epoch)) except OSError: - print('EX: unable to write ' + last_seen_filename) + print('EX: _update_last_seen unable to write ' + last_seen_filename) def _bounce_dm(sender_post_id: str, session, http_prefix: str, @@ -5434,7 +5437,8 @@ def _inbox_after_initial(server, inbox_start_time, encoding='utf-8') as mitm_file: mitm_file.write('\n') except OSError: - print('EX: unable to write ' + destination_filename_mitm) + print('EX: _inbox_after_initial unable to write ' + + destination_filename_mitm) _low_frequency_post_notification(base_dir, http_prefix, nickname, domain, port, @@ -5454,7 +5458,8 @@ def _inbox_after_initial(server, inbox_start_time, encoding='utf-8') as mute_file: mute_file.write('\n') except OSError: - print('EX: unable to write ' + destination_filename_muted) + print('EX: _inbox_after_initial unable to write 2 ' + + destination_filename_muted) # is this an edit of a previous post? # in Mastodon "delete and redraft" @@ -5899,7 +5904,8 @@ def _check_json_signature(base_dir: str, queue_json: {}) -> (bool, bool): encoding='utf-8') as unknown_file: unknown_file.write(unknown_context + '\n') except OSError: - print('EX: unable to append ' + unknown_contexts_file) + print('EX: _check_json_signature unable to append ' + + unknown_contexts_file) else: print('Unrecognized jsonld signature type: ' + jwebsig_type) @@ -5917,7 +5923,8 @@ def _check_json_signature(base_dir: str, queue_json: {}) -> (bool, bool): encoding='utf-8') as unknown_file: unknown_file.write(jwebsig_type + '\n') except OSError: - print('EX: unable to append ' + unknown_signatures_file) + print('EX: _check_json_signature unable to append ' + + unknown_signatures_file) return has_json_signature, jwebsig_type @@ -6199,7 +6206,8 @@ def _receive_follow_request(session, session_onion, session_i2p, encoding='utf-8') as followers_file: followers_file.write(approve_handle + '\n') except OSError: - print('EX: unable to write ' + followers_filename) + print('EX: _receive_follow_request unable to write ' + + followers_filename) else: print('ACCEPT: Follow Accept account directory not found: ' + account_to_be_followed) diff --git a/manualapprove.py b/manualapprove.py index 452ee338e..fcdca7aaa 100644 --- a/manualapprove.py +++ b/manualapprove.py @@ -61,7 +61,8 @@ def manual_deny_follow_request(session, session_onion, session_i2p, encoding='utf-8') as rejects_file: rejects_file.write(deny_handle + '\n') except OSError: - print('EX: unable to append ' + rejected_follows_filename) + print('EX: manual_deny_follow_request unable to append ' + + rejected_follows_filename) deny_nickname = deny_handle.split('@')[0] deny_domain = remove_eol(deny_handle.split('@')[1]) @@ -136,14 +137,16 @@ def _approve_follower_handle(account_dir: str, approve_handle: str) -> None: encoding='utf-8') as approved_file: approved_file.write(approve_handle + '\n') except OSError: - print('EX: unable to append ' + approved_filename) + print('EX: _approve_follower_handle unable to append ' + + approved_filename) else: try: with open(approved_filename, 'w+', encoding='utf-8') as approved_file: approved_file.write(approve_handle + '\n') except OSError: - print('EX: unable to write ' + approved_filename) + print('EX: _approve_follower_handle unable to write ' + + approved_filename) def manual_approve_follow_request(session, session_onion, session_i2p, @@ -334,7 +337,8 @@ def manual_approve_follow_request(session, session_onion, session_i2p, encoding='utf-8') as followers_file: followers_file.write(approve_handle_full + '\n') except OSError: - print('EX: unable to write ' + followers_filename) + print('EX: manual_approve_follow_request unable to write ' + + followers_filename) # only update the follow requests file if the follow is confirmed to be # in followers.txt diff --git a/newsdaemon.py b/newsdaemon.py index 99cd9edd0..cefbc84dd 100644 --- a/newsdaemon.py +++ b/newsdaemon.py @@ -67,7 +67,8 @@ def _update_feeds_outbox_index(base_dir: str, domain: str, with open(index_filename, 'w+', encoding='utf-8') as feeds_file: feeds_file.write(post_id + '\n') except OSError: - print('EX: unable to write ' + index_filename) + print('EX: _update_feeds_outbox_index unable to write ' + + index_filename) def _save_arrived_time(post_filename: str, arrived: str) -> None: @@ -78,7 +79,8 @@ def _save_arrived_time(post_filename: str, arrived: str) -> None: encoding='utf-8') as arrived_file: arrived_file.write(arrived) except OSError: - print('EX: unable to write ' + post_filename + '.arrived') + print('EX: _save_arrived_time unable to write ' + + post_filename + '.arrived') def _remove_control_characters(content: str) -> str: @@ -499,7 +501,8 @@ def _create_news_mirror(base_dir: str, domain: str, encoding='utf-8') as index_file: index_file.write(index_content) except OSError: - print('EX: unable to write ' + mirror_index_filename) + print('EX: _create_news_mirror unable to write ' + + mirror_index_filename) mirror_article_dir = mirror_dir + '/' + post_id_number if os.path.isdir(mirror_article_dir): @@ -529,14 +532,16 @@ def _create_news_mirror(base_dir: str, domain: str, encoding='utf-8') as index_file: index_file.write(post_id_number + '\n') except OSError: - print('EX: unable to append ' + mirror_index_filename) + print('EX: _create_news_mirror unable to append ' + + mirror_index_filename) else: try: with open(mirror_index_filename, 'w+', encoding='utf-8') as index_file: index_file.write(post_id_number + '\n') except OSError: - print('EX: unable to write ' + mirror_index_filename) + print('EX: _create_news_mirror unable to write ' + + mirror_index_filename) return True diff --git a/person.py b/person.py index 14e929e08..120894aed 100644 --- a/person.py +++ b/person.py @@ -608,7 +608,7 @@ def _create_person_base(base_dir: str, nickname: str, domain: str, port: int, with open(filename, 'w+', encoding='utf-8') as text_file: print(private_key_pem, file=text_file) except OSError: - print('EX: unable to save ' + filename) + print('EX: _create_person_base unable to save ' + filename) # save the public key public_keys_subdir = '/keys/public' @@ -619,7 +619,7 @@ def _create_person_base(base_dir: str, nickname: str, domain: str, port: int, with open(filename, 'w+', encoding='utf-8') as text_file: print(public_key_pem, file=text_file) except OSError: - print('EX: unable to save 2 ' + filename) + print('EX: _create_person_base unable to save 2 ' + filename) if password: password = remove_eol(password).strip() @@ -765,7 +765,7 @@ def create_person(base_dir: str, nickname: str, domain: str, port: int, with open(follow_dms_filename, 'w+', encoding='utf-8') as ffile: ffile.write('\n') except OSError: - print('EX: unable to write ' + follow_dms_filename) + print('EX: create_person unable to write ' + follow_dms_filename) # notify when posts are liked if nickname != 'news': @@ -775,7 +775,8 @@ def create_person(base_dir: str, nickname: str, domain: str, port: int, with open(notify_likes_filename, 'w+', encoding='utf-8') as nfile: nfile.write('\n') except OSError: - print('EX: unable to write ' + notify_likes_filename) + print('EX: create_person unable to write 2 ' + + notify_likes_filename) # notify when posts have emoji reactions if nickname != 'news': @@ -786,7 +787,8 @@ def create_person(base_dir: str, nickname: str, domain: str, port: int, encoding='utf-8') as nfile: nfile.write('\n') except OSError: - print('EX: unable to write ' + notify_reactions_filename) + print('EX: create_person unable to write 3 ' + + notify_reactions_filename) theme = get_config_param(base_dir, 'theme') if not theme: @@ -1279,8 +1281,8 @@ def reenable_account(base_dir: str, nickname: str) -> None: if suspended.strip('\n').strip('\r') != nickname: fp_sus.write(suspended) except OSError as ex: - print('EX: unable to save ' + suspended_filename + - ' ' + str(ex)) + print('EX: reenable_account unable to save ' + + suspended_filename + ' ' + str(ex)) def suspend_account(base_dir: str, nickname: str, domain: str) -> None: @@ -1313,7 +1315,7 @@ def suspend_account(base_dir: str, nickname: str, domain: str) -> None: try: os.remove(token_filename) except OSError: - print('EX: suspend_account unable to delete ' + token_filename) + print('EX: suspend_account unable to delete 2 ' + token_filename) suspended_filename = data_dir(base_dir) + '/suspended.txt' if os.path.isfile(suspended_filename): @@ -1326,13 +1328,13 @@ def suspend_account(base_dir: str, nickname: str, domain: str) -> None: with open(suspended_filename, 'a+', encoding='utf-8') as fp_sus: fp_sus.write(nickname + '\n') except OSError: - print('EX: unable to append ' + suspended_filename) + print('EX: suspend_account unable to append ' + suspended_filename) else: try: with open(suspended_filename, 'w+', encoding='utf-8') as fp_sus: fp_sus.write(nickname + '\n') except OSError: - print('EX: unable to write ' + suspended_filename) + print('EX: suspend_account unable to write ' + suspended_filename) def can_remove_post(base_dir: str, @@ -1395,7 +1397,8 @@ def _remove_tags_for_nickname(base_dir: str, nickname: str, if match_str not in tagline: tag_file.write(tagline) except OSError: - print('EX: unable to write ' + tag_filename) + print('EX: _remove_tags_for_nickname unable to write ' + + tag_filename) def remove_account(base_dir: str, nickname: str, @@ -1565,7 +1568,8 @@ def is_person_snoozed(base_dir: str, nickname: str, domain: str, encoding='utf-8') as snoozfile: snoozfile.write(content) except OSError: - print('EX: unable to write ' + snoozed_filename) + print('EX: is_person_snoozed unable to write ' + + snoozed_filename) if text_in_file(snooze_actor + ' ', snoozed_filename): return True @@ -1589,7 +1593,7 @@ def person_snooze(base_dir: str, nickname: str, domain: str, snoozed_file.write(snooze_actor + ' ' + str(int(time.time())) + '\n') except OSError: - print('EX: unable to append ' + snoozed_filename) + print('EX: person_snooze unable to append ' + snoozed_filename) def person_unsnooze(base_dir: str, nickname: str, domain: str,