Ticket #15 (closed defect: fixed)

Opened 3 years ago

Last modified 6 months ago

better error message for unsupported CL syntax

Reported by: perry Assigned to: somebody
Priority: normal Milestone: PyRAF 1.6
Component: none Version:
Severity: normal Keywords:
Cc:

Description

Hi Perry & Warren, I got this comment from a collaborator who had a bit of trouble getting started with pyraf. He reports that the 'cl.images.imutil' syntax actually comes from an old version of the drizzle cookbook (we might want to have a look at that.) As I said in my reply, I don't recommend that we try to emulate iraf's behavior in this case, but it would be nice to get a better error message out of the startup process. Probably this should be added to the list of things we would like to improve about pyraf initialization. (The error occurs before the traceback mechanism has been modified to do some special stuff for CL scripts, so the traceback actually gives little hint as to what is wrong & no clue at all as to where it failed.)

Rick


Date: Thu, 4 Dec 2003 09:14:34 -0500 (EST) From: Rick White <rlw@stsci.edu> To: Michael Gregg <gregg@organa.ucllnl.org> Cc: Rick White <rlw@stsci.edu> Subject: Re: pyraf/iraf syntax problem

Hi Michael,

On Wed, 3 Dec 2003, Michael Gregg wrote:

I decided this week to take the plunge and try using pyraf instead of iraf to drizzle my ACS data sets. I immediately hit a roadblock that has taken a bit of scratching my head to figure out. Pyraf would not even finish starting for me - I kept getting dumped into just python because of a startup error. I'll spare you the details, but I tracked it down to a line in my login.cl file. I load imutil as one of the packages in my login.cl, but I have been doing it as:

cl.images.imutil

instead of just imutil. I am pretty sure that this comes from copying an example file in a drizzle cookbook exercise. Anyway, pyraf won't start until I change this to:

images imutil

on separate lines, or even

images.imutil

dropping the cl. Iraf, on the other hand, doesn't care. I'm probably the only user in the universe with this problem, but I thought you might want to hear about it.

Hmm, it looks like in this context iraf interprets 'cl' as an abbreviation for 'clpackage', which is the actual name of the package. Since 'cl' is an exact match for the name of a task (in pyraf as well as iraf), pyraf assumes that you actually do mean 'cl' and complains about there being no parameter named 'images'.

I'm not inclined to try to fix this, I guess, but I'll pass it on to the pyraf group. It would be nice if you got a more helpful message about the source of the problem. (The usual pyraf error messages for errors in CL code are much clearer, but during the initialization process the error handling stuff has not been loaded yet so the messages are pretty cryptic.) Maybe that can be improved.

Incidentally, you don't need to load this package at all in your login.cl -- it gets loaded by default when you load the images package.

Rick

Change History

02/21/08 15:06:43 changed by sontag

The traceback in v1.5:

setting terminal type to xterm...
Traceback (most recent call last):
  File "/usr/jojo/dev/bld/pyraf/pyraf", line 62, in <module>
    from pyraf import doCmdline, _use_ipython_shell, iraf, __version__
  File "/usr/jojo/dev/bld/pyraf/__init__.py", line 139, in <module>
    iraf.Init(**_initkw)
  File "/usr/jojo/dev/bld/pyraf/iraffunctions.py", line 244, in Init
    userpkg.run(_doprint=0, _hush=hush, _save=1)
  File "/usr/jojo/dev/bld/pyraf/iraftask.py", line 277, in run
    self._run(redirKW, specialKW)
  File "/usr/jojo/dev/bld/pyraf/iraftask.py", line 1533, in _run
    self._runCode()
  File "/usr/jojo/dev/bld/pyraf/iraftask.py", line 1346, in _runCode
    apply(self._clFunction, parList, kw)
  File "<CL script clpackage.user>", line 52, in login
  File "/usr/jojo/dev/bld/pyraf/iraftask.py", line 650, in __getattr__
    return self.getParam(name,native=1)
  File "/usr/jojo/dev/bld/pyraf/iraftask.py", line 474, in getParam
    exact=exact, prompt=prompt)
  File "/usr/jojo/dev/bld/pyraf/iraftask.py", line 529, in _getParValue
    paramname)
pyraf.irafglobals.IrafError: Unknown parameter requested: images
>>> 

02/21/08 15:41:22 changed by sontag

  • status changed from new to closed.
  • resolution set to fixed.
  • milestone set to PyRAF 1.6.

It is not trivial to catch this case without a design overhaul of error-handling during initialization. Instead, the error message in question was elaborated with task and package-name information in an attempt to make debugging this (rare) issue a bit easier on the user.

Changes made in r826.

02/21/08 15:42:16 changed by sontag

  • version deleted.