Skip to content

Commit

Permalink
[ExamineSnap] do not raise a warning when SNAP is not installed, but …
Browse files Browse the repository at this point in the history
…rather raise an AttributeError when trying to access the attributes path or gpt
  • Loading branch information
johntruckenbrodt committed May 15, 2024
1 parent 9c3fc41 commit e7e8665
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions pyroSAR/examine.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,14 @@ def __init__(self):
self.__update_config()

def __getattr__(self, item):
raise AttributeError("'ExamineSnap' object has no attribute '{}'".format(item))
if item in ['path', 'gpt']:
msg = ('SNAP could not be identified. If you have installed it '
'please add the path to the SNAP executables (bin subdirectory) '
'to the PATH environment. E.g. in the Linux .bashrc file add '
'the following line:\nexport PATH=$PATH:path/to/snap/bin"')
else:
msg = "'ExamineSnap' object has no attribute '{}'".format(item)
raise AttributeError(msg)

def __is_identified(self):
"""
Expand Down Expand Up @@ -168,10 +175,6 @@ def __identify_snap(self):
self.etc = etc
self.gpt = gpt
return

log.warning('SNAP could not be identified. If you have installed it please add the path to the SNAP '
'executables (bin subdirectory) to the PATH environment. '
'E.g. in the Linux .bashrc file add the following line:\nexport PATH=$PATH:path/to/snap/bin"')

def __read_config(self):
"""
Expand Down

0 comments on commit e7e8665

Please sign in to comment.