Skip to content

Commit ce85c61

Browse files
authored
Update README for Python 3
fix code mistakes, make it python3 compatible
2 parents 7b91162 + ebf80b7 commit ce85c61

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

README.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ If you would like to see if a bag is valid, use its ``is_valid`` method:
174174
175175
bag = bagit.Bag('/path/to/bag')
176176
if bag.is_valid():
177-
print "yay :)"
177+
print("yay :)")
178178
else:
179-
print "boo :("
179+
print("boo :(")
180180
181181
If you'd like to get a detailed list of validation errors, execute the
182182
``validate`` method and catch the ``BagValidationError`` exception. If
@@ -197,11 +197,11 @@ validate you can do this:
197197
try:
198198
bag.validate()
199199
200-
except bagit.BagValidationError, e:
201-
for d in e.details:
202-
if isinstance(d, bag.ChecksumMismatch):
203-
print "expected %s to have %s checksum of %s but found %s" % \
204-
(e.path, e.algorithm, e.expected, e.found)
200+
except bagit.BagValidationError as e:
201+
for d in e.details:
202+
if isinstance(d, bagit.ChecksumMismatch):
203+
print("expected %s to have %s checksum of %s but found %s" %
204+
(d.path, d.algorithm, d.expected, d.found))
205205
206206
To iterate through a bag's manifest and retrieve checksums for the
207207
payload files use the bag's entries dictionary:
@@ -211,7 +211,7 @@ payload files use the bag's entries dictionary:
211211
bag = bagit.Bag("/path/to/bag")
212212
213213
for path, fixity in bag.entries.items():
214-
print "path:%s md5:%s" % (path, fixity["md5"])
214+
print("path:%s md5:%s" % (path, fixity["md5"]))
215215
216216
Contributing to bagit-python development
217217
----------------------------------------

0 commit comments

Comments
 (0)