[petsc-users] minor error message compiling
Satish Balay
balay at mcs.anl.gov
Wed Aug 8 12:03:40 CDT 2012
On Wed, 8 Aug 2012, Nachiket Gokhale wrote:
> I just upgraded to 3.3 and while compiling I get the following error:
>
> Traceback (most recent call last):
> File "/opt/petsc/petsc-3.3-p2/bin/petscnagupgrade.py", line 54, in <module>
> petscdir = os.environ['PETSC_DIR']
> File "/usr/local/lib/python2.7/UserDict.py", line 23, in __getitem__
> raise KeyError(key)
> KeyError: 'PETSC_DIR'
> make: [petscnagupgrade] Error 1 (ignored)
>
> Seems to occur only when the env variable PETSC_DIR is not defined;
> the program seems to compile properly inspite of this error.
Hm petscnagupgrade.py is primarily invoked by make - and when using
PETSc makefiles - PETSC_DIR is always set - so I'm not sure why you
get this error.
Are you using PETSc makefiles? What make are you using? [gnu/ bsd/solaris?]
Does the attached patch fix it?
patch -Np1 < petscnag.patch
Satish
-------------- next part --------------
diff --git a/bin/petscnagupgrade.py b/bin/petscnagupgrade.py
--- a/bin/petscnagupgrade.py
+++ b/bin/petscnagupgrade.py
@@ -51,7 +51,12 @@
#
#
if __name__ == '__main__':
- petscdir = os.environ['PETSC_DIR']
+ if os.environ.has_key('PETSC_DIR'):
+ petscdir = os.environ['PETSC_DIR']
+ elif os.path.exists(os.path.join('.', 'include', 'petscversion.h')):
+ petscdir = '.'
+ else:
+ sys.exit(0)
file = os.path.join(petscdir,'.nagged')
if not naggedtoday(file):
currentversion(petscdir)
More information about the petsc-users
mailing list