Untitled
unknown
plain_text
2 years ago
1.3 kB
4
Indexable
Earlier this was the original code- try: bookmark_line = linecache.getline(syslog_file, int(bookmark_index)).strip() print("Bookmark Line:", bookmark_line) except Exception as e: print("Exception while reading line from file:", e) logging.error("Exception while reading line from file %s ",e) return None if not bookmark_line: print("Bookmark line not found.") logging.error("Bookmark line not found.") continue But since we are using current date now for searching in file in new code- try: bookmark_line = linecache.getline(syslog_file, str(current_date)).strip().strip() print("Bookmark Line:", bookmark_line) except Exception as e: print("Exception while reading line from file:", e) logging.error("Exception while reading line from file %s ", e) return None SO we are getting error here- bookmark_line = linecache.getline(syslog_file, str(current_date)).strip().strip() It is not able to search using str(current_date) and not able to get bookmark_line, thereby throwing error- Exception while reading line from file: '<=' not supported between instances of 'int' and 'str' Can you please help fix this issue.
Editor is loading...
Leave a Comment