We're Hiring!

Import with python problems

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

Re: Import with python problems

Postby sukunis » Thu Jun 21, 2018 11:14 am

Hi Josh,

I test the invoke login with cli import and get the following error:
Code: Select all
File "./script", line 82, in upload_to_omero_cli
    cli.invoke(cmd)
  File "/home/omero/OMERO.server-5.3.5-ice36-b73/lib/python/omero/cli.py", line 992, in invoke
    stop = self.onecmd(line, previous_args)
  File "/home/omero/OMERO.server-5.3.5-ice36-b73/lib/python/omero/cli.py", line 1069, in onecmd
    self.execute(line, previous_args)
  File "/home/omero/OMERO.server-5.3.5-ice36-b73/lib/python/omero/cli.py", line 1151, in execute
    args.func(args)
  File "/home/omero/OMERO.server-5.3.5-ice36-b73/lib/python/omero/plugins/import.py", line 480, in importer
    command_args = CommandArguments(self.ctx, args)
  File "/home/omero/OMERO.server-5.3.5-ice36-b73/lib/python/omero/plugins/import.py", line 114, in __init__
    self.set_login_arguments(ctx, args)
  File "/home/omero/OMERO.server-5.3.5-ice36-b73/lib/python/omero/plugins/import.py", line 229, in set_login_arguments
    client = ctx.conn(args)
  File "/home/omero/OMERO.server-5.3.5-ice36-b73/lib/python/omero/cli.py", line 1327, in conn
    self.controls["sessions"].login(args)
  File "/home/omero/OMERO.server-5.3.5-ice36-b73/lib/python/omero/plugins/sessions.py", line 406, in login
    server, name, port = self._get_server(store, name, port)
  File "/home/omero/OMERO.server-5.3.5-ice36-b73/lib/python/omero/plugins/sessions.py", line 886, in _get_server
    rv = self.ctx.input("Server: [%s:%s]" % (defserver, port))
  File "/home/omero/OMERO.server-5.3.5-ice36-b73/lib/python/omero/cli.py", line 555, in input
    rv = raw_input(prompt)
EOFError: EOF when reading a line
!! 06/21/18 13:07:03.763 error: communicator not destroyed during global destruction.


Script:
Code: Select all
def upload_to_omero_cli(conn,imagePath,imgSrc):
    dataset = imgSrc.getParent()

    # import via cli
    client = conn.c
    cmd = "import %s -d %s" % (imagePath, dataset.id)
    print cmd

    cli = omero.cli.CLI()
    cli.loadplugins()
    cli.set_client(client)
    #invoke login
    cli.invoke("hql -q 'select g.name from ExperimenterGroup g'")
    cli.invoke(cmd)


Regards,
Susanne
sukunis
 
Posts: 16
Joined: Fri Sep 18, 2015 8:12 am

Re: Import with python problems

Postby jmoore » Thu Jun 21, 2018 1:40 pm

Hi Susanne,

sorry for the confusion. Please replace:

Code: Select all
    cli.set_client(client)
    #invoke login


with

Code: Select all
    cli.invoke("login")


Gruß,
~Josh.
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: Import with python problems

Postby sukunis » Fri Jun 22, 2018 12:58 pm

Hi Josh, Hi Will,

now it works. I was wonder that the import failed with all the hints you gave me, but after killing all the orphaned script sessions it works.
So thank you very much for the help!

Regards
Susanne
sukunis
 
Posts: 16
Joined: Fri Sep 18, 2015 8:12 am

Previous

Return to Developer Discussion

Who is online

Users browsing this forum: No registered users and 0 guests