]> git.ipfire.org Git - location/libloc.git/blobdiff - src/python/location.in
location(8): Allow downloading a database without one on disk
[location/libloc.git] / src / python / location.in
index c4987a5ccae6672606b60ad2602f770520bf42f6..5189738c449cb082e0d3cef6b88d57e4818335b7 100644 (file)
@@ -199,9 +199,14 @@ class CLI(object):
                try:
                        db = location.Database(args.database)
                except FileNotFoundError as e:
-                       sys.stderr.write("location: Could not open database %s: %s\n" \
-                               % (args.database, e))
-                       sys.exit(1)
+                       # Allow continuing without a database
+                       if args.func == self.handle_update:
+                               db = None
+
+                       else:
+                               sys.stderr.write("location: Could not open database %s: %s\n" \
+                                       % (args.database, e))
+                               sys.exit(1)
 
                # Translate family (if present)
                if "family" in args: