Hi Troels, For better user feedback, I would suggest adding a "if not dep_check.showApod_software: raise RelaxError(...)" condition as well. Most users will have the subprocess module, but many will also not have showApod installed. So this condition prevents the execution of the non-existent showApod program while telling the user what the problem is.
Cheers, Edward On 5 September 2014 11:09, <[email protected]> wrote: > Author: tlinnet > Date: Fri Sep 5 11:09:49 2014 > New Revision: 25664 > > URL: http://svn.gna.org/viewcvs/relax?rev=25664&view=rev > Log: > Fix for raising error when calling showApod, and subprocess module not > available. > > Modified: > trunk/lib/spectrum/nmrpipe.py > > Modified: trunk/lib/spectrum/nmrpipe.py > URL: > http://svn.gna.org/viewcvs/relax/trunk/lib/spectrum/nmrpipe.py?rev=25664&r1=25663&r2=25664&view=diff > ============================================================================== > --- trunk/lib/spectrum/nmrpipe.py (original) > +++ trunk/lib/spectrum/nmrpipe.py Fri Sep 5 11:09:49 2014 > @@ -212,20 +212,19 @@ > # Get the file path. > file_path = get_file_path(file_name=file_name, dir=dir) > > - if dep_check.subprocess_module: > - # Call function. > - Temp=subprocess.Popen([path_to_command, file_path], > stdout=subprocess.PIPE) > - > - # Communicate with program, and get outout and exitcode. > - (output, errput) = Temp.communicate() > - > - # Wait for finish and get return code. > - return_value = Temp.wait() > - > - return output.splitlines() > - > - else: > - raise RelaxError("python module 'subprocess' not found. Cannot call > showApod.") > + if not dep_check.subprocess_module: > + raise RelaxError("Python module 'subprocess' not found, cannot call > showApod.") > + > + # Call function. > + Temp = subprocess.Popen([path_to_command, file_path], > stdout=subprocess.PIPE) > + > + # Communicate with program, and get outout and exitcode. > + (output, errput) = Temp.communicate() > + > + # Wait for finish and get return code. > + return_value = Temp.wait() > + > + return output.splitlines() > > > def show_apod_rmsd(file_name=None, dir=None, path_to_command='showApod'): > > > _______________________________________________ > relax (http://www.nmr-relax.com) > > This is the relax-commits mailing list > [email protected] > > To unsubscribe from this list, get a password > reminder, or change your subscription options, > visit the list information page at > https://mail.gna.org/listinfo/relax-commits _______________________________________________ relax (http://www.nmr-relax.com) This is the relax-devel mailing list [email protected] To unsubscribe from this list, get a password reminder, or change your subscription options, visit the list information page at https://mail.gna.org/listinfo/relax-devel

