Re: FileInput exiting on IOError
David Goodger <goodger <at> python.org>
2012-03-12 03:40:58 GMT
On Tue, Feb 28, 2012 at 08:38, Guenter Milde <milde <at> users.sf.net> wrote:
> Dear David,
>
> I am still waiting for a consensus regarding the IOError handling.
I'm sorry about that. I wrote most of a reply some time ago, but was
troubled about part of it, and then life got in the way.
I had a big problem with the patch as-is, and felt that a discussion
first was better. I apologize for the long delay.
> On 2012-01-22, Guenter Milde wrote:
>> On 2012-01-20, David Goodger wrote:
>>> On Fri, Jan 20, 2012 at 05:01, Guenter Milde <milde <at> users.sf.net> wrote:
>>>> On 2010-12-28, Eli Bendersky wrote:
>
> Maybe we can start with the simpler decisions:
>
>>>>> I'm using docutils programmatically for converting ReST to HTML
>>>>> (specifically docutils.core.publish_from_doctree). Since the
>>>>> usage is programmatic (controlled by my application) I must have
>>>>> full control of exceptions for logging. However, I noticed that
>>>>> the FileInput class used by docutils for various purposes exits
>>>>> the application (sys.exit) when it can't find a file.
>
> IMO this is a valid bug report. There should be an option to
> suppress the conversion of IOError into sys.exit() (especially for
> programmatic use).
I agree.
>>> Instead, how about adding a command-line/config option to control
>>> this? Then programmatic users can handle any exceptions themselves,
>>> and regular users won't see any change.
>
>> I don't think that an additional config setting is necessary. The
>> "traceback" setting already switches between passing exceptions to the
>> caller or catching and reporting exceptions by
>> core.Publisher.report_Exceptions.
>
> Could you agree on using the "traceback" setting for IOErrors, too?
Yes, that makes sense.
> Regular users would only see a change, if they use the --traceback
> option. Tey get a traceback instead of the short error message, e.g.
>
> Traceback (most recent call last):
> File "/home/milde/.bin/rst2html", line 23, in <module>
> ...
> docutils.io.InputError: [Errno 2] Datei oder Verzeichnis nicht gefunden: u'foffy'
>
> I hope you can agree on these two points and look forward to
> discussing the implementation.
My now-completed earlier reply will follow.
--
--
David Goodger <http://python.net/~goodger>
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Docutils-users mailing list
Docutils-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users
Please use "Reply All" to reply to the list.