Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copying groups containing external links #205

Open
rayosborn opened this issue Sep 19, 2023 · 0 comments
Open

Copying groups containing external links #205

rayosborn opened this issue Sep 19, 2023 · 0 comments
Labels

Comments

@rayosborn
Copy link
Contributor

I have not fully diagnosed this problem, but when attempting to copy an NXdata group that contained external links, the following exception was raised by h5py.

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
File ~/Documents/Computing/Repositories/nexpy/src/nexpy/gui/mainwindow.py:1600, in MainWindow.copy_data(self)
   1598 node = self.treeview.get_node()
   1599 if not isinstance(node, NXroot):
-> 1600     self.copied_node = self.copy_node(node)
   1601     logging.info(f"'{node.nxpath}' copied")
   1602 else:

File ~/Documents/Computing/Repositories/nexpy/src/nexpy/gui/mainwindow.py:1584, in MainWindow.copy_node(self, node)
   1582 if isinstance(node, NXlink):
   1583     node = node.nxlink
-> 1584 self._memroot['entry'][node.nxname] = node
   1585 self._memroot['entry'].attrs['link'] = [node.nxname, node.nxpath,
   1586                                         str(node.nxfilename)]
   1587 return self._memroot['entry'][node.nxname]

File ~/Documents/Computing/Repositories/nexusformat/src/nexusformat/nexus/tree.py:4626, in NXgroup.__setitem__(self, key, value)
   4623 elif (isinstance(group.entries[key], NXentry) and
   4624       not isinstance(group, NXroot)):
   4625     group.entries[key].nxclass = NXsubentry
-> 4626 group.entries[key].update()

File ~/Documents/Computing/Repositories/nexusformat/src/nexusformat/nexus/tree.py:4725, in NXgroup.update(self)
   4723 if self.nxfilemode == 'rw':
   4724     with self.nxfile as f:
-> 4725         f.update(self)
   4726 elif self.nxfilemode is None:
   4727     for node in self.walk():

File ~/Documents/Computing/Repositories/nexusformat/src/nexusformat/nexus/tree.py:1336, in NXFile.update(self, item)
   1334     self._writedata(item)
   1335 elif isinstance(item, NXgroup):
-> 1336     links = self._writegroup(item)
   1337     self._writelinks(links)
   1338 elif isinstance(item, NXobject):

File ~/Documents/Computing/Repositories/nexusformat/src/nexusformat/nexus/tree.py:1020, in NXFile._writegroup(self, group)
   1017         links += [(self.nxpath+"/"+child.nxname, child._target,
   1018                    child._soft)]
   1019 elif isinstance(child, NXfield):
-> 1020     links += self._writedata(child)
   1021 else:
   1022     links += self._writegroup(child)

File ~/Documents/Computing/Repositories/nexusformat/src/nexusformat/nexus/tree.py:1060, in NXFile._writedata(self, data)
   1058 if _file._filename != self._filename:
   1059     with _file as f:
-> 1060         f.copy(_path, self[self.nxparent], name=self.nxpath)
   1061 else:
   1062     self.copy(_path, self[self.nxparent], name=self.nxpath)

File ~/Documents/Computing/Repositories/nexusformat/src/nexusformat/nexus/tree.py:1281, in NXFile.copy(self, source, destination, **kwargs)
   1268 def copy(self, source, destination, **kwargs):
   1269     """Copy an object defined by its path to another location.
   1270 
   1271     This is an interface to the `h5py.Group` copy function. All the
   (...)
   1279         Path of the new copy.
   1280     """
-> 1281     self.file.copy(source, destination, **kwargs)

File ~/opt/miniconda3/envs/py310/lib/python3.10/site-packages/h5py/_hl/group.py:597, in Group.copy(self, source, dest, name, shallow, expand_soft, expand_external, expand_refs, without_attrs)
    594 else:
    595     copypl = None
--> 597 h5o.copy(source.id, self._e(source_path), dest.id, self._e(dest_path),
    598          copypl, base.dlcpl)

File h5py/_objects.pyx:54, in h5py._objects.with_phil.wrapper()

File h5py/_objects.pyx:55, in h5py._objects.with_phil.wrapper()

File h5py/h5o.pyx:217, in h5py.h5o.copy()

RuntimeError: Unable to synchronously copy object (object 'signal' doesn't exist)

@rayosborn rayosborn added the bug label Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant