X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=bkmk2db.py;h=629668d4cbc99fe7dd8690376bfa6b0875b22d4c;hb=HEAD;hp=0beea071a0b5ca8e5b0ed83b98ce778745108295;hpb=c2ea4e82718b903aa123dd77490f36657383b0ca;p=bookmarks_db.git diff --git a/bkmk2db.py b/bkmk2db.py index 0beea07..629668d 100755 --- a/bkmk2db.py +++ b/bkmk2db.py @@ -1,12 +1,14 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 """Convert Netscape Navigator's or Mozilla's bookmarks.html to a database This file is a part of Bookmarks database and Internet robot. """ from __future__ import print_function -import sys, os from getopt import getopt +import os +import sys + from bkmk_parser import BkmkParser @@ -40,8 +42,8 @@ def run(): filename = args[0] else: - filename = 'bookmarks.html' # good name both for DOS (bookmark.htm) and UNIX - + # good name both for DOS (bookmark.htm) and UNIX + filename = 'bookmarks.html' if report_stats: from storage import storage_name @@ -64,7 +66,6 @@ def run(): print(filename, ": no such file") sys.exit(1) - if show_pbar: pbar = ttyProgressBar(0, size) lng = 0 @@ -75,8 +76,7 @@ def run(): else: dos_add = 0 # UNIX' and Mac's len() counts CR or LF correct - - infile = open(filename, 'r') + infile = open(filename, 'rt') parser = BkmkParser() line_no = 0 @@ -88,7 +88,7 @@ def run(): lng = lng + len(line) + dos_add pbar.display(lng) - #line = line.strip() + # line = line.strip() line_no = line_no + 1 try: