<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Josh,<div class=""><br class=""></div><div class="">Thanks for your help. I can now transfer an image from one OMERO to another  : )</div><div class=""><br class=""></div><div class="">I’ve put the latest version of the script at <a href="https://github.com/SynthSys/omero-user-scripts/blob/master/Export_to_other_omero.py" class="">https://github.com/SynthSys/omero-user-scripts/blob/master/Export_to_other_omero.py</a></div><div class=""><br class=""></div><div class="">I’ve got more questions though:</div><div class="">How can I find the managed repository directory? (Something like omero.managed.dir, Default: ${omero.data.dir}/ManagedRepository ?)</div>How can I hide the password text entry? <br class="">How can I get the newly created image id? It is printed to stdout as "Image:920" for example, but I don't know how to get hold of that number in my script.<div class=""><br class=""></div><div class=""><br class=""></div><div class="">Also, the docker script you sent didn’t quite work (don’t worry about it though, I got what I needed from your example) - I got this error when I ran the python script:</div><div class=""><br class=""></div><div class="">bash-4.2$ python /gist/export_to_remote_omero.py<br class="">Traceback (most recent call last):<br class="">  File "/gist/export_to_remote_omero.py", line 24, in <module><br class="">    sf = c.createSession(REMOTE_USER, REMOTE_PASS)<br class="">  File "/opt/omero/server/OMERO.server-5.4.0-ice36-b74/lib/python/omero/clients.py", line 569, in createSession<br class="">    prx = rtr.createSession(username, password, ctx)<br class="">  File "/usr/lib64/python2.7/site-packages/Glacier2_Router_ice.py", line 258, in createSession<br class="">    return _M_Glacier2.Router._op_createSession.invoke(self, ((userId, password), _ctx))<br class="">Glacier2.PermissionDeniedException: exception ::Glacier2::PermissionDeniedException<br class="">{<br class="">    reason = internal server error<br class="">}<br class=""><br class=""></div><div class="">Thanks,</div><div class="">Eilidh</div><div class=""><br class=""></div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 10 Nov 2017, at 09:22, Josh Moore <<a href="mailto:josh@glencoesoftware.com" class="">josh@glencoesoftware.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Hi Elidh,<br class=""><br class="">On Thu, Nov 9, 2017 at 5:07 PM, Eilidh Troup <<a href="mailto:e.troup@epcc.ed.ac.uk" class="">e.troup@epcc.ed.ac.uk</a>> wrote:<br class=""><blockquote type="cite" class="">Hi,<br class=""><br class="">I’ve run into a similar problem as last time.<br class=""></blockquote><br class="">Turns out, there's a similar solution.<br class=""><br class=""><blockquote type="cite" class="">I’ve written a script that<br class="">will upload an image to a remote OMERO server, but only from the python<br class="">command line, and not from within a script running in a local OMERO. As<br class="">before, the script will work from the command line or from with OMERO when<br class="">transferring the image to the local OMERO server. When I try to import an<br class="">image on the remote server, I get the following error:<br class=""></blockquote>...<br class=""><blockquote type="cite" class=""><br class="">The code, and full error output are below.<br class="">I’ve also put it into a different script on gist that demonstrates the error<br class="">by running it from within OMERO as a script.<br class=""><a href="https://gist.github.com/eilidh-t/e763dab7d4f3515cc85b0b6ddfb8d9f4" class="">https://gist.github.com/eilidh-t/e763dab7d4f3515cc85b0b6ddfb8d9f4</a><br class=""></blockquote><br class="">I've update your script:<br class=""><a href="https://gist.github.com/joshmoore/0c2e5319d8d5ae7f79ee82e3e68b721b" class="">https://gist.github.com/joshmoore/0c2e5319d8d5ae7f79ee82e3e68b721b</a><br class=""><br class="">The most important change is:<br class=""><br class="">    del os.environ["ICE_CONFIG"] before importing<br class=""><br class="">which does the equivalent of `Ice.Config=/dev/null` but for the import<br class="">process. Likely, that should be done closer to the top.<br class=""><br class="">Other changes include:<br class=""><br class=""> * use ome.cli.CLI rather than calling subprocess (simplicity)<br class=""> * only register the script if it doesn't exist (less test mess)<br class=""> * pass a key to not store the root's password (security)<br class=""> * adding a warning about the security whole that this script could<br class="">cause (security)<br class=""><br class="">My general workflow was:<br class=""><br class=""> * docker-compose up -d<br class=""> * docker-compose exec omero1 bash<br class=""> * cd /opt/omero/server/OMERO.server<br class=""> * export PYTHONPATH=lib/python<br class=""> * python /gist/export_to_remote_omero.py<br class=""><br class="">If I needed to change the script, I deleted the uploaded file from<br class="">lib/script/export_to_remote_omero.py and re-ran.<br class=""><br class=""><blockquote type="cite" class="">Thanks for your help with this,<br class="">Eilidh<br class=""></blockquote><br class=""><br class="">Let us know if that works for you.<br class="">~J<br class="">_______________________________________________<br class="">ome-devel mailing list<br class=""><a href="mailto:ome-devel@lists.openmicroscopy.org.uk" class="">ome-devel@lists.openmicroscopy.org.uk</a><br class="">http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel<br class=""></div></div></blockquote></div><br class=""></div></div></body></html>