0

I am reading in a group from an hdf5 file, in which some of the group members are external links. I would like to be able to identify which group members are external links, and subsequently ignore them for further reading.

Example code:

f = h5py.File(filename, 'r')
data = f['header']
for p in date.keys:
    (if p is an external link, detect it here!)
Samuel
  • 157
  • 6
  • 22
  • I'm using get(name, default=None, getclass=False, getlink=False) to retrieve whether it's a external link or not. If I print the type I get, for example, . What do I put in an if statement to get the external link bit? – Samuel Jul 23 '15 at 12:09

1 Answers1

0

Working code:

f = h5py.File(filename, 'r')
data = f['header']
for p in date.keys:
    if bool('h5py._hl_.group.ExternalLink' in str(type(data.get(p, getlink=True))))):
        print 'External link found!'

Beautifully pythonic, I know... ;)

Samuel
  • 157
  • 6
  • 22