On Jul 13, 6:26 am, seldan24 wrote:
> Hello,
>
> I'm fairly new at Python so hopefully this question won't be too
> awful. I am writing some code that will FTP to a host, and want to
> catch any exception that may occur, take that and print it out
> (eventually put it into a log file and perform
On Tue, 14 Jul 2009 08:53:33 -0700, Carl Banks wrote:
> On Jul 14, 2:14 am, Steven D'Aprano
> wrote:
>> On Tue, 14 Jul 2009 01:30:48 -0700, Carl Banks wrote:
>> > Seriously, do you *ever* take more than 2 seconds to consider whether
>> > you might be missing something obvious before following up
> Carl Banks (CB) wrote:
>CB> On Jul 14, 4:48 am, Lawrence D'Oliveiro central.gen.new_zealand> wrote:
>>> In message <93f6a517-63d8-4c80-
>>>
>>> bf19-4614b7099...@m7g2000prd.googlegroups.com>, Carl Banks wrote:
>>> > Or would you rather let all unexpected exceptions print to standard
>>> >
On Jul 14, 4:48 am, Lawrence D'Oliveiro wrote:
> In message <93f6a517-63d8-4c80-
>
> bf19-4614b7099...@m7g2000prd.googlegroups.com>, Carl Banks wrote:
> > Or would you rather let all unexpected exceptions print to standard
> > error, which is often a black hole in non-interactive sitations?
>
> Si
On Jul 14, 2:14 am, Steven D'Aprano
wrote:
> On Tue, 14 Jul 2009 01:30:48 -0700, Carl Banks wrote:
> > Seriously, do you *ever* take more than 2 seconds to consider whether
> > you might be missing something obvious before following up with these
> > indignant knee-jerk responses?
>
> Obviously no
In message , seldan24 wrote:
> For this particular script, all exceptions are fatal
> and I would want them to be. I just wanted a way to catch them and
> log them prior to program termination.
You don't need to. They will be written to standard error anyway.
--
http://mail.python.org/mailman/
In message <93f6a517-63d8-4c80-
bf19-4614b7099...@m7g2000prd.googlegroups.com>, Carl Banks wrote:
> Or would you rather let all unexpected exceptions print to standard
> error, which is often a black hole in non-interactive sitations?
Since when?
Cron, for example, collects standard error and ma
On Tue, 14 Jul 2009 01:30:48 -0700, Carl Banks wrote:
> Seriously, do you *ever* take more than 2 seconds to consider whether
> you might be missing something obvious before following up with these
> indignant knee-jerk responses?
Obviously not.
[...]
> Or would you rather let all unexpected ex
On Jul 13, 8:25 pm, Steven D'Aprano
wrote:
> On Mon, 13 Jul 2009 17:49:23 -0700, Carl Banks wrote:
> > On Jul 13, 12:31 pm, Piet van Oostrum wrote:
> >> > seldan24 (s) wrote:
> >> >s> Hello,
> >> >s> I'm fairly new at Python so hopefully this question won't be too s>
> >> >awful. I am writi
Steven D'Aprano writes:
> Isn't that risky though? Won't that potentially change the exception-
> handling behaviour of functions and classes he imports from other
> modules?
No, any existing ‘except’ clause will be unaffected by re-binding
‘sys.excepthook’. As I understand the documentation, th
On Tue, 14 Jul 2009 10:09:06 +1000, Ben Finney wrote:
> Instead of catching *all* exceptions at a specific point in your code,
> and then having nothing to do but end the program (possibly after some
> pre-exit action like logging), I think you would be better served by
> installing a custom top-l
On Mon, 13 Jul 2009 17:49:23 -0700, Carl Banks wrote:
> On Jul 13, 12:31 pm, Piet van Oostrum wrote:
>> > seldan24 (s) wrote:
>> >s> Hello,
>> >s> I'm fairly new at Python so hopefully this question won't be too s>
>> >awful. I am writing some code that will FTP to a host, and want to s>
>>
On Jul 13, 12:31 pm, Piet van Oostrum wrote:
> > seldan24 (s) wrote:
> >s> Hello,
> >s> I'm fairly new at Python so hopefully this question won't be too
> >s> awful. I am writing some code that will FTP to a host, and want to
> >s> catch any exception that may occur, take that and print it o
seldan24 writes:
> I'm fairly new at Python so hopefully this question won't be too
> awful. I am writing some code that will FTP to a host, and want to
> catch any exception that may occur, take that and print it out
> (eventually put it into a log file and perform some alerting action).
You h
Diez B. Roggisch wrote:
The latter is - unfortunately - the better. This comes from python allowing
all kinds of objects being thrown as exceptions, not only those extending
from a common ancestor like Exception.
Fixed in Python 3. exceptions, without exceptions, are instances of
BaseExceptio
> seldan24 (s) wrote:
>s> Hello,
>s> I'm fairly new at Python so hopefully this question won't be too
>s> awful. I am writing some code that will FTP to a host, and want to
>s> catch any exception that may occur, take that and print it out
>s> (eventually put it into a log file and perform s
2009/7/13 seldan24 :
> Thank you both for your input. I want to make sure I get started on
> the right track. For this particular script, I should have included
> that I would take the exception contents, and pass those to the
> logging module. For this particular script, all exceptions are fata
On Jul 13, 2:26 pm, seldan24 wrote:
> The first example:
>
> from ftplib import FTP
> try:
> ftp = FTP(ftp_host)
> ftp.login(ftp_user, ftp_pass)
> except Exception, err:
> print err
*If* you really do want to catch *all* exceptions (as mentioned
already it is usually better to catch s
On Jul 13, 10:33 am, MRAB wrote:
> seldan24 wrote:
> > Hello,
>
> > I'm fairly new at Python so hopefully this question won't be too
> > awful. I am writing some code that will FTP to a host, and want to
> > catch any exception that may occur, take that and print it out
> > (eventually put it int
seldan24 wrote:
Hello,
I'm fairly new at Python so hopefully this question won't be too
awful. I am writing some code that will FTP to a host, and want to
catch any exception that may occur, take that and print it out
(eventually put it into a log file and perform some alerting action).
I've fi
seldan24 wrote:
> Hello,
>
> I'm fairly new at Python so hopefully this question won't be too
> awful. I am writing some code that will FTP to a host, and want to
> catch any exception that may occur, take that and print it out
> (eventually put it into a log file and perform some alerting actio
Hello,
I'm fairly new at Python so hopefully this question won't be too
awful. I am writing some code that will FTP to a host, and want to
catch any exception that may occur, take that and print it out
(eventually put it into a log file and perform some alerting action).
I've figured out two diff
22 matches
Mail list logo