<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hi Niko,</div><div><br></div><div> You should be able to use conn.c to access the underlying omero.client in the</div><div>Blitz Gateway. This client is already connected (don't need to call createClient).</div><div>So you can simply do:</div><div><br></div><div>cli = omero.cli.CLI()</div><div>cli.loadplugins()</div><div>cli._client = conn.c</div><div>cli.invoke(["import", path_to_file])</div><div><br></div><div><br></div><div>You might also find something useful at</div><a href="https://www.openmicroscopy.org/community/viewtopic.php?f=6&t=7562&p=14258">https://www.openmicroscopy.org/community/viewtopic.php?f=6&t=7562&p=14258</a><div><br></div><div>which links to this example: <a href="https://github.com/ome/omego/blob/master/auto_import.py">https://github.com/ome/omego/blob/master/auto_import.py</a></div><div><br></div><div>Regards,</div><div><br></div><div>  Will.</div><div><br><div><br></div><div><br><div><div>On 12 May 2015, at 08:29, Niko Ehrenfeuchter <<a href="mailto:nikolaus.ehrenfeuchter@unibas.ch">nikolaus.ehrenfeuchter@unibas.ch</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi again,<br><br>one more question regarding this: is there a way to create the CLI() object using an existing BlitzGateway connection?<br><br>I'm only asking since all the rest of my script is currently based on the conn object only, so it were very nice if I could simply re-use that.<br><br>Thanks<br>~Niko<br><br>On 12.05.2015 00:00, Niko Ehrenfeuchter wrote:<br><blockquote type="cite">Hi Ola,<br><br>thanks for the quick response, I'll go for the omero.cli version then.<br><br>The example in the thread mentioned is very helpful, btw!<br><br>Best<br>~Niko<br><br>On 11.05.2015 23:47, Aleksandra Tarkowska (Staff) wrote:<br><blockquote type="cite">Hi Niko,<br><br>I am affraid that is the way to do it. Please see similar thread<br><br><a href="http://lists.openmicroscopy.org.uk/pipermail/ome-devel/2014-September/002982.html">http://lists.openmicroscopy.org.uk/pipermail/ome-devel/2014-September/002982.html</a><br><br><br><br>Kind regards<br>Ola<br><br><blockquote type="cite">On 11 May 2015, at 21:45, Niko Ehrenfeuchter<br><nikolaus.ehrenfeuchter@unibas.ch> wrote:<br><br>Hi all,<br><br>I was wondering what the best method for calling the importer from<br>within a Python script might be?<br><br>I've looked at uploadFile() from omero.util.script_utils, but in my<br>understanding that's not for images - or am I wrong here?<br><br>Delusively, the most simple thing would be to use<br>omero.plugins.import, but as far as I can see the plugins are not<br>meant as modules to be imported in other Python scripts but rather<br>for extending the OMERO command line interface.<br><br>Of course I could use popen() to call the "real" command line<br>interface directly, but it feels a bit stupid calling a Python script<br>from another one where all the OMERO stuff has already been set up.<br><br>My approach now would be to use the CLI class from omero.cli, but I<br>wanted to know if there is a better way that I am overlooking?<br><br>Many Thanks,<br>~Niko<br>--<br>Niko Ehrenfeuchter | Image Analysis Specialist | Biozentrum,<br>University of Basel | Klingelbergstr. 50/70 | CH-4056 Basel<br>Phone: +41 (61) 26 72673 | nikolaus.ehrenfeuchter@unibas.ch |<br>www.biozentrum.unibas.ch | www.microscopynetwork.unibas.ch<br>_______________________________________________<br>ome-devel mailing list<br>ome-devel@lists.openmicroscopy.org.uk<br>http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel<br></blockquote><br>The University of Dundee is a registered Scottish Charity, No: SC015096<br>_______________________________________________<br>ome-devel mailing list<br>ome-devel@lists.openmicroscopy.org.uk<br>http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel<br><br></blockquote><br></blockquote><br>-- <br>Niko Ehrenfeuchter | Image Analysis Specialist | Biozentrum, University of Basel | Klingelbergstr. 50/70 | CH-4056 Basel<br>Phone: +41 (61) 26 72673 | <a href="mailto:nikolaus.ehrenfeuchter@unibas.ch">nikolaus.ehrenfeuchter@unibas.ch</a> | <a href="http://www.biozentrum.unibas.ch">www.biozentrum.unibas.ch</a> | <a href="http://www.microscopynetwork.unibas.ch">www.microscopynetwork.unibas.ch</a><br>_______________________________________________<br>ome-devel mailing list<br><a href="mailto:ome-devel@lists.openmicroscopy.org.uk">ome-devel@lists.openmicroscopy.org.uk</a><br>http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel<br></blockquote></div><br></div></div></body></html>