<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; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif; ">
<div>
<div>Hi Niko,</div>
<div><br>
</div>
<div>
<div>First looks like example in the thread was moved to</div>
<div>https://github.com/openmicroscopy/openmicroscopy/blob/develop/components/tests/python/library/__init__.py#L219</div>
</div>
<div>That may gives you a better idea ;-)</div>
<div><br>
</div>
<div>Also in the example below client object should be set using:</div>
<div><br>
</div>
<div>cli.set_client(conn.c)</div>
<div><br>
</div>
<div>
<div>
<div>Kind regards</div>
<div>Ola</div>
</div>
</div>
</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>William Moore <<a href="mailto:will@lifesci.dundee.ac.uk">will@lifesci.dundee.ac.uk</a>><br>
<span style="font-weight:bold">Reply-To: </span>OME External Developer List <<a href="mailto:ome-devel@lists.openmicroscopy.org.uk">ome-devel@lists.openmicroscopy.org.uk</a>><br>
<span style="font-weight:bold">Date: </span>Tue, 12 May 2015 10:05:34 +0100<br>
<span style="font-weight:bold">To: </span>OME External Developer List <<a href="mailto:ome-devel@lists.openmicroscopy.org.uk">ome-devel@lists.openmicroscopy.org.uk</a>><br>
<span style="font-weight:bold">Subject: </span>Re: [ome-devel] Calling the importer from Python<br>
</div>
<div><br>
</div>
<div>
<div 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>
<<a href="mailto:nikolaus.ehrenfeuchter@unibas.ch">nikolaus.ehrenfeuchter@unibas.ch</a>> 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 | <a href="mailto:nikolaus.ehrenfeuchter@unibas.ch">nikolaus.ehrenfeuchter@unibas.ch</a> |<br>
www.biozentrum.unibas.ch | www.microscopynetwork.unibas.ch<br>
_______________________________________________<br>
ome-devel mailing list<br>
<a href="mailto:ome-devel@lists.openmicroscopy.org.uk">ome-devel@lists.openmicroscopy.org.uk</a><br>
<a href="http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel">http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel</a><br>
</blockquote>
<br>
The University of Dundee is a registered Scottish Charity, No: SC015096<br>
_______________________________________________<br>
ome-devel mailing list<br>
<a href="mailto:ome-devel@lists.openmicroscopy.org.uk">ome-devel@lists.openmicroscopy.org.uk</a><br>
<a href="http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel">http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel</a><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>
<a href="http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel">http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel</a><br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
_______________________________________________ ome-devel mailing list <a href="mailto:ome-devel@lists.openmicroscopy.org.uk">
ome-devel@lists.openmicroscopy.org.uk</a> <a href="http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel">
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel</a> </span><br>
<span style="font-size:10pt;">The University of Dundee is a registered Scottish Charity, No: SC015096</span>
</body>
</html>