Warning: Can't synchronize with repository "(default)" (/home/git/ome.git does not appear to be a Git repository.). Look in the Trac log for more information.
Notice: In order to edit this ticket you need to be either: a Product Owner, The owner or the reporter of the ticket, or, in case of a Task not yet assigned, a team_member"

Task #7341 (closed)

Opened 12 years ago

Closed 12 years ago

BUG:Feedback 4057 - KeyError on OMERO_HOME in config.py

Reported by: omero-qa Owned by: jamoore
Priority: minor Milestone: OMERO-4.4
Component: OmeroPy Version: n.a.
Keywords: n.a. Cc: icaoberg@…
Resources: n.a. Referenced By: n.a.
References: n.a. Remaining Time: 0.0d
Sprint: 2011-11-29 (3)

Description

http://qa.openmicroscopy.org.uk/qa/feedback/4057/

Comment: When I try to query an image using the image id.

Traceback (most recent call last):

  File "/home/omero/OMERO.server-Beta-4.2.1/lib/python/django/core/handlers/base.py", line 92, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "/home/omero/OMERO.server-Beta-4.2.1/lib/python/omeroweb/webclient/views.py", line 157, in wrapped
    return f(request, *args, **kwargs)

  File "/home/omero/OMERO.server-Beta-4.2.1/lib/python/omeroweb/webclient/views.py", line 741, in load_searching
    OMERO_HOME = str(cfg['OMERO_HOME'])

  File "/home/omero/OMERO.server-Beta-4.2.1/lib/python/omero/config.py", line 267, in __getitem__
    return self.props_to_dict(self.properties(self.default()))[key]

KeyError: 'OMERO_HOME'


<WSGIRequest
GET:<QueryDict: {u'images': [u'on'], u'query': [u'10460']}>,
POST:<QueryDict: {}>,
COOKIES:{'sessionid': 'b98ca7425ba30e965b76a6e6570dddf4'},
META:{'DOCUMENT_ROOT': '/var/www',
 'GATEWAY_INTERFACE': 'CGI/1.1',
 'HTTP_ACCEPT': 'text/html, */*',
 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
 'HTTP_ACCEPT_ENCODING': 'gzip,deflate,sdch',
 'HTTP_ACCEPT_LANGUAGE': 'en-GB,en-US;q=0.8,en;q=0.6',
 'HTTP_CONNECTION': 'keep-alive',
 'HTTP_COOKIE': 'sessionid=b98ca7425ba30e965b76a6e6570dddf4',
 'HTTP_HOST': 'searcher-usa-dev.glencoesoftware.com',
 'HTTP_REFERER': 'http://searcher-usa-dev.glencoesoftware.com/webclient/search/',
 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.120 Safari/535.2',
 'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest',
 'PATH': '/usr/local/bin:/usr/bin:/bin',
 'PATH_INFO': u'/webclient/load_searching/form/',
 'PATH_TRANSLATED': '/home/omero/OMERO-CURRENT/var/omero.fcgi/webclient/load_searching/form/',
 'QUERY_STRING': 'query=10460&images=on',
 'REMOTE_ADDR': '128.237.254.206',
 'REMOTE_PORT': '61763',
 'REQUEST_METHOD': 'GET',
 'REQUEST_URI': '/webclient/load_searching/form/?query=10460&images=on',
 'SCRIPT_FILENAME': '/home/omero/OMERO-CURRENT/var/omero.fcgi',
 'SCRIPT_NAME': u'',
 'SERVER_ADDR': '10.2.181.157',
 'SERVER_ADMIN': 'webmaster@localhost',
 'SERVER_NAME': 'searcher-usa-dev.glencoesoftware.com',
 'SERVER_PORT': '80',
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'SERVER_SIGNATURE': '<address>Apache/2.2.14 (Ubuntu) Server at searcher-usa-dev.glencoesoftware.com Port 80</address>\n',
 'SERVER_SOFTWARE': 'Apache/2.2.14 (Ubuntu)',
 'wsgi.errors': <flup.server.fcgi_base.TeeOutputStream object at 0x39868d0>,
 'wsgi.input': <flup.server.fcgi_base.InputStream object at 0x3986c10>,
 'wsgi.multiprocess': True,
 'wsgi.multithread': False,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'http',
 'wsgi.version': (1, 0)}>

Change History (2)

comment:1 Changed 12 years ago by jmoore

  • Component changed from from QA to OmeroPy
  • Milestone changed from Unscheduled to OMERO-Beta4.4
  • Remaining Time set to 0.1
  • Sprint set to 2011-11-29 (3)
  • Status changed from new to accepted

comment:2 Changed 12 years ago by jmoore

  • Remaining Time changed from 0.1 to 0
  • Resolution set to wontfix
  • Status changed from accepted to closed
  • Summary changed from BUG:Feedback 4057 - key error in config.py to BUG:Feedback 4057 - KeyError on OMERO_HOME in config.py

Hi Ivan,

the ConfigXml object behaves largely like a single Python dict, and so if you try to access a key that is not present, it throws a KeyError. Unless you've manually set OMERO_HOME via:

bin/omero config set OMERO_HOME somevalue

then it won't be present, in which case you should handle the KeyError in your code. If you'd like a full-fledged dict-API, use ConfigXml.as_map which you can then use with defaults:

  m = cfg.as_map()
  m.get("OMERO_HOME", "my default value")
Note: See TracTickets for help on using tickets. You may also have a look at Agilo extensions to the ticket.

1.3.13-PRO © 2008-2011 Agilo Software all rights reserved (this page was served in: 0.64359 sec.)

We're Hiring!