Re: opening a file



On Jan 14, 9:30 am, Chris Mattern <sys...@xxxxxxxxxxxxxx> wrote:
If you don't care whether the file opens, why are you opening it?

My point was that you can conjure up an exception for every rule.

In my job, I constantly write and run scripts that open and close
files. Many of these scripts are on-the-fly scripts. I've been at work
for three hours today, and already I've written two of these kinds of
scripts and have run around two dozen. Very rarely do I bother
checking the return value of open(), and I don't ever recall having an
open fail. The biggest problem I have is with typographical errors,
and warnings catch those.

I totally agree with error checking, and the scripts that I write for
others to run ALWAYS include this kind of error checking. The scripts
that I write FOR MYSELF for processing files rarely do, however,
because open() never fails and I'm too lazy to take the extra effort
(small though it may be) to type out the 'or die' clause. My quibble
is not with the rule, but with the idea that the rule has no
exceptions. Every rule has exceptions.

If it's any consolation, I am the only one that suffers the penalty
for not checking whether or not a file opens in my own scripts, and I
am perfectly willing to risk incurring the penalty to keep from typing
a few extra keystrokes with every invocation of open. This is a
deliberate choice on my part, and I have never sought to impose that
choice on anyone else.

CC
.



Relevant Pages

  • Re: opening a file
    ... Many of these scripts are on-the-fly scripts. ... Every rule has exceptions. ... for not checking whether or not a file opens in my own scripts, ... Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers ...
    (comp.lang.perl.misc)
  • Re: word opens without opening the document, like /n
    ... shortcut, ... I first noticed this behavior after running automation scripts. ... opens Word, opens a document, changes it, then closes Word. ... Do registry setting over ride command line switches? ...
    (microsoft.public.word.docmanagement)
  • Re: Opening multiple files at once, interface and flicker issues
    ... The first is to have opening scripts which should be triggered if the user navigates to them using the Window>> Show Window menu option. ... The second is to use FileMaker Advanced to actually remove the Window menu option thus preventing the user from opening those files. ... opens another file, the password is "inherited" and the second file's ...
    (comp.databases.filemaker)
  • Re: Python Scripts to logon to websites
    ... Thanks for your help with the search terms. ... Trying to make scripts that will open ... >> Does anyone have a simple example of a script that opens, say, gmail or ...
    (comp.lang.python)
  • Re: Constants for catch return values?
    ... negative response. ... The complex part of dealing with exceptions is not ... They consider it good programming practise to force ... We also don't want to bugger them to rewrite their scripts ...
    (comp.lang.tcl)