There is a better way to do this and that would be to check if the
file already exists.  If it does, then throw a RelaxFileOverwriteError
so that the file is not overwritten.  This idea is similar to what is
being done in relax_io.open_write_file(), specifically where the force
flag is being used.  You just need to use the access() function with
F_OK.

Regards,

Edward


On Fri, Oct 24, 2008 at 3:43 PM, Sébastien Morin
<[EMAIL PROTECTED]> wrote:
> Hi Ed,
>
> Could you give me your opinion concerning this fix ?
>
> If the script used is not a .py file, than the fix won't work...
>
> Do you think of a better way to do that ?
>
> Cheers,
>
>
> Séb
>
>
>
> [EMAIL PROTECTED] wrote:
>> Author: semor
>> Date: Fri Oct 24 15:41:46 2008
>> New Revision: 7965
>>
>> URL: http://svn.gna.org/viewcvs/relax?rev=7965&view=rev
>> Log:
>> Introduced verifications for the '-t' and '-l' options not to erase the 
>> python script used.
>>
>> This should fix bug 12498 (http://gna.org/bugs/?12498).
>>
>>
>> Modified:
>>     1.3/relax
>>
>> Modified: 1.3/relax
>> URL: 
>> http://svn.gna.org/viewcvs/relax/1.3/relax?rev=7965&r1=7964&r2=7965&view=diff
>> ==============================================================================
>> --- 1.3/relax (original)
>> +++ 1.3/relax Fri Oct 24 15:41:46 2008
>> @@ -202,6 +202,10 @@
>>
>>              # The log file.
>>              log_file = options.log
>> +
>> +            # Verify that logging won't erase the script used (a '.py' file)
>> +            if options.log.endswith(".py"):
>> +                log_file = 'LOG_FILE'
>>          else:
>>              log_file = None
>>
>> @@ -213,6 +217,10 @@
>>
>>              # The tee file.
>>              tee_file = options.tee
>> +
>> +            # Verify that tee won't erase the script used (a '.py' file)
>> +            if options.tee.endswith(".py"):
>> +                tee_file = 'TEE_FILE'
>>          else:
>>              tee_file = None
>>
>>
>>
>> _______________________________________________
>> relax (http://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://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
>

_______________________________________________
relax (http://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

Reply via email to