[issue22472] OSErrors should use str and not repr on paths

2021-06-21 Thread Antoine Pitrou
Antoine Pitrou added the comment: I'll close as rejected. Unfortunately, we have to make an exclusive choice here :-( -- ___ Python tracker ___

[issue22472] OSErrors should use str and not repr on paths

2021-06-21 Thread Antoine Pitrou
Change by Antoine Pitrou : -- resolution: -> rejected stage: needs patch -> resolved status: open -> closed ___ Python tracker ___

[issue22472] OSErrors should use str and not repr on paths

2021-06-21 Thread Irit Katriel
Irit Katriel added the comment: Should this be closed as rejected, or is there anything left to do? -- nosy: +iritkatriel ___ Python tracker ___

[issue22472] OSErrors should use str and not repr on paths

2014-10-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: вівторок, 30-вер-2014 19:26:52 ви написали: How do I reconstruct an arbitrary OSError error message using the filename parameter? if not e.args: msg = '' elif len(e.args) == 1: msg = str(e.args[0]) elif len(e.args) = 5: msg = '[Error %s] %s' %

[issue22472] OSErrors should use str and not repr on paths

2014-10-01 Thread R. David Murray
R. David Murray added the comment: Thank you, Serhiy. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22472 ___ ___ Python-bugs-list mailing list

[issue22472] OSErrors should use str and not repr on paths

2014-09-30 Thread Akira Li
Akira Li added the comment: I meant, in general, repr() is better for an error message because it should be unambigous unlike str() but in your particular case you could use filename attribute to format the way you like it for your UI. -- ___ Python

[issue22472] OSErrors should use str and not repr on paths

2014-09-30 Thread Antoine Pitrou
Antoine Pitrou added the comment: Also, the repr() makes it easier to copy-paste in Python code (e.g. on the prompt). -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22472

[issue22472] OSErrors should use str and not repr on paths

2014-09-30 Thread R. David Murray
R. David Murray added the comment: OK, so I have to add a filter to my logger that looks for a filename attribute on exceptions and and if it finds one...does what? How do I reconstruct an arbitrary OSError error message using the filename parameter? --

[issue22472] OSErrors should use str and not repr on paths

2014-09-29 Thread Akira Li
Akira Li added the comment: OSError has *filename* attribute. Could it be passed to the UI instead? -- nosy: +akira ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22472 ___

[issue22472] OSErrors should use str and not repr on paths

2014-09-29 Thread R. David Murray
R. David Murray added the comment: No, because I'm just logging the error message. That's the UI. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22472 ___

[issue22472] OSErrors should use str and not repr on paths

2014-09-24 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22472 ___

[issue22472] OSErrors should use str and not repr on paths

2014-09-23 Thread R. David Murray
New submission from R. David Murray: open(r'c:\bad\path') Traceback (most recent call last): File stdin, line 1, in module FileNotFoundError: [Errno 2] No such file or directory: 'c:\\bad\\path' -- components: Windows messages: 227389 nosy: r.david.murray priority: normal severity:

[issue22472] OSErrors should use str and not repr on paths

2014-09-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: File names can contain special characters such as spaces or even newlines. str() can be ambiguous. I prefer always use repr() for file names or other user data. -- nosy: +serhiy.storchaka ___ Python tracker

[issue22472] OSErrors should use str and not repr on paths

2014-09-23 Thread R. David Murray
R. David Murray added the comment: I realized that after I hit submit. However, this is a real problem on windows: I can't pass the error message back to the UI (in this case the log file) without first munging it, because the string is not a correct representation of the filename and the