spacetelescope / drizzlepac

AstroDrizzle for HST images.
https://drizzlepac.readthedocs.io
BSD 3-Clause "New" or "Revised" License
52 stars 38 forks source link

tweakreg: stsci.tools maybe broken #398

Closed kyika closed 5 years ago

kyika commented 5 years ago

Hi,

Previously I can run the tweakreg.TweakReg without error, but these days I made some update of some of my packages, and rewrite my code, find that whatever the parameter I used in tweakreg, it returns a error like below:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-59-059b4a57cb87> in <module>
----> 1 tweakreg.TweakReg(flist)

/anaconda3/envs/astroconda/lib/python3.7/site-packages/drizzlepac/tweakreg.py in TweakReg(files, editpars, configobj, imagefindcfg, refimagefindcfg, **input_dict)
    790     elif configobj is None:
    791         # load 'astrodrizzle' parameter defaults as described in the docs:
--> 792         configobj = teal.load(__taskname__, defaults=True)
    793 
    794     if files and not util.is_blank(files):

/anaconda3/envs/astroconda/lib/python3.7/site-packages/stsci/tools/teal.py in load(theTask, canExecute, strict, defaults)
    235     return teal(theTask, parent=None, loadOnly=True, returnAs="dict",
    236                 canExecute=canExecute, strict=strict, errorsToTerm=True,
--> 237                 defaults=defaults)
    238 
    239 

/anaconda3/envs/astroconda/lib/python3.7/site-packages/stsci/tools/teal.py in teal(theTask, parent, loadOnly, returnAs, canExecute, strict, errorsToTerm, autoClose, defaults)
    173         obj = None
    174         try:
--> 175             obj = cfgpars.getObjectFromTaskArg(theTask, strict, defaults)
    176 #           obj.strictUpdate(overrides) # ! would need to re-verify after this !
    177         except Exception as re: # catches RuntimeError and KeyError and ...

/anaconda3/envs/astroconda/lib/python3.7/site-packages/stsci/tools/cfgpars.py in getObjectFromTaskArg(theTask, strict, setAllToDefaults)
     80     if isinstance(theTask, str) and setAllToDefaults:
     81         # NOTE how we pass the task name string in setAllToDefaults
---> 82         return ConfigObjPars('', setAllToDefaults=theTask, strict=strict)
     83     else:
     84         return getParsObjForPyPkg(theTask, strict)

/anaconda3/envs/astroconda/lib/python3.7/site-packages/stsci/tools/cfgpars.py in __init__(self, cfgFileName, forUseWithEpar, setAllToDefaults, strict, associatedPkg, forceReadOnly)
    518             self.__taskName = vtor_checks.sigStrToKwArgsDict(sigStr)['default']
    519         else:
--> 520             cfgSpecPath = self._findAssociatedConfigSpecFile(cfgFileName)
    521         assert os.path.exists(cfgSpecPath), \
    522                "Matching configspec not found!  Expected: "+cfgSpecPath

/anaconda3/envs/astroconda/lib/python3.7/site-packages/stsci/tools/cfgpars.py in _findAssociatedConfigSpecFile(self, cfgFileName)
    852         # file in that directory
    853         x, theFile = findCfgFileForPkg(self.__taskName, '.cfgspc',
--> 854                                        taskName = self.__taskName)
    855         if os.path.exists(theFile):
    856             return theFile

/anaconda3/envs/astroconda/lib/python3.7/site-packages/stsci/tools/cfgpars.py in findCfgFileForPkg(pkgName, theExt, pkgObj, taskName)
    164     for aPkgName in pkgsToTry:
    165         aPkg = pkgsToTry[aPkgName]
--> 166         path = os.path.dirname(aPkg.__file__)
    167         if len(path) < 1: path = '.'
    168         flist = irafutils.rglob(path, "*"+ext)

/anaconda3/envs/astroconda/lib/python3.7/posixpath.py in dirname(p)
    154 def dirname(p):
    155     """Returns the directory component of a pathname"""
--> 156     p = os.fspath(p)
    157     sep = _get_sep(p)
    158     i = p.rfind(sep) + 1

TypeError: expected str, bytes or os.PathLike object, not NoneType

do you have any idea of what happened, and how to solve it? I would be very grateful if you can help me.

p.s. software version below:

Mac OS 10.13.6 conda 4.6.12 Drizzlepac 2.2.6 tweakreg 1.4.7 updated on 18-April-2018 python 3.7.3 numpy 1.16.4 astropy 3.1.2 stwcs 1.4.2

mcara commented 5 years ago

I cannot reproduce this error. My environment is:

python 3.7.3
drizzlepac: 2.2.6
drizzlepac.tweakreg: 1.4.7
np: 1.16.4
astropy: 3.2
stwcs: 1.4.2
stsci.tools: 3.4.13

What exactly is the flist parameter in the call to TweakReg()?