[ome-devel] cli.invoke() closes session

Eilidh Troup e.troup at epcc.ed.ac.uk
Thu Jan 25 16:51:00 GMT 2018


Hi,

I’m writing a script to transfer images from one OMERO to another, remote OMERO. When I call cli.invoke, it works, but then closes the session, so I have to create a new session for every call of cli.invoke. Is there a better way to do this?

Thanks,
Eilidh


import omero 
import omero.cli
REMOTE_HOST = 'demo.openmicroscopy.org <http://demo.openmicroscopy.org/>'
REMOTE_PORT = 4064
username = ""
password = ""
c = omero.client(host=REMOTE_HOST, port=REMOTE_PORT,args=["--Ice.Config=/dev/null", "--omero.debug=1"])
c.createSession(username,password)
cli = omero.cli.CLI()
cli.loadplugins()
cli.set_client(c)
del os.environ["ICE_CONFIG"]
file_loc = "/Users/eilidhtroup/OMERO/ManagedRepository/root_0/2017-12/05/20-55-11.910/antibiotic_plate.jpg"
cli.invoke(["import", file_loc]) #works - remote
cli.invoke(["import", file_loc]) # doesn't work - will import into local session if one exists.
c.createSession(username,password)
cli.set_client(c)
cli.invoke(["import", file_loc]) #works again -remote.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-devel/attachments/20180125/31862731/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: not available
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-devel/attachments/20180125/31862731/attachment.ksh>


More information about the ome-devel mailing list