Author: bugman Date: Fri Jul 21 05:01:18 2006 New Revision: 2523 URL: http://svn.gna.org/viewcvs/relax?rev=2523&view=rev Log: Fix to bug #6403. The bug is located at https://gna.org/bugs/?func=detailitem&item_id=6403. The problem is that relax will not start due to an ImportError when trying to import the object 'devnull'. The solution was to import the object using a try statement to allow execution of the program. However if relax ever attempts to use 'devnull' a RelaxError is thrown, a message saying to upgrade to Python >= 2.4 is printed, and the program terminates. This is currently only a problem in the test-suite. Modified: 1.2/docs/latex/install.tex 1.2/io.py Modified: 1.2/docs/latex/install.tex URL: http://svn.gna.org/viewcvs/relax/1.2/docs/latex/install.tex?rev=2523&r1=2522&r2=2523&view=diff ============================================================================== --- 1.2/docs/latex/install.tex (original) +++ 1.2/docs/latex/install.tex Fri Jul 21 05:01:18 2006 @@ -12,13 +12,13 @@ The following packages need to be installed before using relax: \begin{description} -\item[Python:] Version 2.2 or higher\index{Python}. +\item[Python:] Version 2.4 or higher\index{Python} (although any 2.x version may work). \item[Numeric:] Version 21 or higher\index{Numeric}. \item[ScientificPython:] Version 2.2 or higher\index{ScientificPython}. -\item[Optik:] Version 1.4 or higher. This is only needed if running python 2.2\index{Optik}. +\item[Optik:] Version 1.4 or higher. This is only needed if running python <= 2.2\index{Optik}. \end{description} -Older versions of these packages may work, use them at your own risk. +Older versions of these packages may work, use them at your own risk. If, for older dependency versions, errors do occur please submit a bug report to the bug tracker\index{bug tracker} at \href{https://gna.org/bugs/?group=relax}{https://gna.org/bugs/?group=relax}. That way a solution may be created for the next relax release. Modified: 1.2/io.py URL: http://svn.gna.org/viewcvs/relax/1.2/io.py?rev=2523&r1=2522&r2=2523&view=diff ============================================================================== --- 1.2/io.py (original) +++ 1.2/io.py Fri Jul 21 05:01:18 2006 @@ -33,7 +33,15 @@ # Gzip compression module. from gzip import GzipFile -from os import F_OK, access, devnull, makedirs, remove, stat +# Devnull. +try: + from os import devnull + __builtin__.devnull_import = 1 +except ImportError, message: + __builtin__.devnull_import = 0 + __builtin__.devnull_import_message = message.args[0] + +from os import F_OK, access, makedirs, remove, stat from os.path import expanduser from re import match, search from string import split @@ -247,6 +255,10 @@ # The null device. if search('devnull', file_name): + # Devnull could not be imported! + if not devnull_import: + raise RelaxError, devnull_import_message + ". To use devnull, please upgrade to Python >= 2.4." + # Print out. if print_flag: print "Opening the null device file for writing."