diff --git a/functions.py b/functions.py index 7f41ba0..539a569 100644 --- a/functions.py +++ b/functions.py @@ -61,7 +61,9 @@ class Photo: # Create metadata object with all data to write for key, value in zip(keys, values): - metadata[key] = pyexiv2.ExifTag(key, value) + # Only create object if there is anything to fill with + if value is not None: + metadata[key] = pyexiv2.ExifTag(key, value) # Write Exif tags to file, if not in dry-run mode if dry_run == 'True': diff --git a/rad_tag.py b/rad_tag.py index 6b14f8e..eec245a 100755 --- a/rad_tag.py +++ b/rad_tag.py @@ -56,10 +56,10 @@ position_list = [] # Import GeigerCounter log with open(args.csv, "r") as f: - csv_reader = csv.reader(filter(lambda row: row[0] != '#', f), - delimiter=',', skipinitialspace=True) + csv = csv.reader(filter(lambda row: row[0] != '#', f), + delimiter=',', skipinitialspace=True) - for _, csv_raw_time, csv_raw_cpm, _ in csv_reader: + for _, csv_raw_time, csv_raw_cpm, _ in csv: radiation = Radiation(csv_raw_time, csv_raw_cpm, local_timezone, args.sifactor) radiation_list.append(radiation) #print(radiation_list)