UnboundLocalError: cannot access local variable 'pix_id' where it is not associated with a value
Stack Trace
self = <test.integration.clitest.test_pyramids.TestRemovePyramidsFullAdmin object at 0x7f4360971350>
tmpdir = local('/tmp/pytest-of-omero/pytest-6/test_remove__pre_fs_pyramids0')
capsys = <_pytest.capture.CaptureFixture object at 0x7f434419c810>
def test_remove__pre_fs_pyramids(self, tmpdir, capsys):
"""Test removepyramids for pre-fs data"""
> self.import_pyramid_pre_fs(tmpdir)
test/integration/clitest/test_pyramids.py:200:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <test.integration.clitest.test_pyramids.TestRemovePyramidsFullAdmin object at 0x7f4360971350>
tmpdir = local('/tmp/pytest-of-omero/pytest-6/test_remove__pre_fs_pyramids0')
def import_pyramid_pre_fs(self, tmpdir):
name = "test&sizeX=4000&sizeY=4000.fake"
fakefile = tmpdir.join(name)
fakefile.write('')
pixels = self.import_image(filename=str(fakefile), skip="checksum")[0]
id = int(float(pixels))
# wait for the pyramid to be generated
self.wait_for_pyramid(id)
query_service = self.client.sf.getQueryService()
pixels_service = self.client.sf.getPixelsService()
orig_pix = query_service.findByQuery(
"select p from Pixels p where p.id = :id",
ParametersI().addId(id))
orig_fs = query_service.findByQuery(
"select f from Image i join i.fileset f where i.id = :id",
ParametersI().addId(orig_pix.image.id.val))
try:
new_img = pixels_service.copyAndResizeImage(
orig_pix.image.id.val, rint(4000), rint(4000), rint(1),
rint(1), [0], None, True).val
pix_id = unwrap(query_service.projection(
"select p.id from Image i join i.pixels p where i.id = :id",
ParametersI().addId(new_img)))[0][0]
# This won't work but it but we then have a pyramid without fileset
self.copyPixels(orig_pix, PixelsI(pix_id, False))
except omero.InternalException:
print("Cannot copy pixels for image %s" % orig_pix.image.id.val)
finally:
self.delete([orig_fs])
> return pix_id
^^^^^^
E UnboundLocalError: cannot access local variable 'pix_id' where it is not associated with a value
test/integration/clitest/test_pyramids.py:126: UnboundLocalError