[issue27493] logging module fails with unclear error when supplied a (Posix)Path

2016-07-24 Thread Berker Peksag

Changes by Berker Peksag :


--
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27493] logging module fails with unclear error when supplied a (Posix)Path

2016-07-22 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5424252ce174 by Berker Peksag in branch 'default':
Issue #27493: Fix test_path_objects under Windows
https://hg.python.org/cpython/rev/5424252ce174

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27493] logging module fails with unclear error when supplied a (Posix)Path

2016-07-22 Thread Martin Panter

Martin Panter added the comment:

Windows fails the test:

http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/7989/steps/test/logs/stdio
==
ERROR: test_path_objects (test.test_logging.HandlerTest)
--
Traceback (most recent call last):
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_logging.py", 
line 599, in test_path_objects
os.unlink(fn)
PermissionError: [WinError 32] The process cannot access the file because it is 
being used by another process: 
'C:\\Users\\Buildbot\\AppData\\Local\\Temp\\tmplffg6d26'

--
nosy: +martin.panter
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27493] logging module fails with unclear error when supplied a (Posix)Path

2016-07-22 Thread Roundup Robot

Roundup Robot added the comment:

New changeset fada654c5f72 by Vinay Sajip in branch 'default':
Closes #27493: accepted Path objects in file handlers for logging.
https://hg.python.org/cpython/rev/fada654c5f72

--
nosy: +python-dev
resolution:  -> fixed
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27493] logging module fails with unclear error when supplied a (Posix)Path

2016-07-21 Thread Vinay Sajip

Vinay Sajip added the comment:

> the answer would be "not at all".

Not sure about that. If all logging did were to pass the path to lower levels 
such as open or abspath, that may be true. However, some handlers do path 
computations (e.g. the rotating file handlers) and so logging would need to 
have a minimal awareness of PEP 519 or else call str() on any putative filename 
passed in, and be completely unaware of it (assuming that str() on a Path would 
return the same as __fspath__().

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27493] logging module fails with unclear error when supplied a (Posix)Path

2016-07-12 Thread R. David Murray

R. David Murray added the comment:

It will be interesting to see how much logging itself needs to be aware of PEP 
519 once the support is added to posixpath.  ideally, to meet the goals of PEP 
519, the answer would be "not at all".

@richard: python uses duck typing: if it quacks like a duck, pretend it is a 
duck.  That means that the code (generally, there are exceptions) doesn't check 
for types, but just handles the object the way it normally would until it fails 
to quack, at which point you get an exception.  Sometimes we add code to turn 
such exceptions into clearer error messages, when the existing error *hides* 
what is really going on.  This would not be one of those cases though, even if 
supporting Path wasn't on the long term agenda: the existing error tells you 
that the module expects it to act like a string (support startswith, and other 
string methods).

--
nosy: +r.david.murray

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27493] logging module fails with unclear error when supplied a (Posix)Path

2016-07-12 Thread Vinay Sajip

Vinay Sajip added the comment:

> We could possibly add PEP 519 support to the logging module for Python 3.6

Seems like a reasonable enhancement for 3.6.

--
stage:  -> needs patch
type:  -> enhancement
versions: +Python 3.6 -Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27493] logging module fails with unclear error when supplied a (Posix)Path

2016-07-12 Thread Richard

Richard added the comment:

Yeah, figured as much. But thanks:)

I'm kind of new to Python and was having some problems determining whether this 
is as it should be, or if it should be improved.
After all, I could not find any documentation that states what the permitted 
variable-types are (for pretty much any function, actually), yet print() does 
cast the Path()s to a string...

Kind of used to the documentation format on php.net :P

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27493] logging module fails with unclear error when supplied a (Posix)Path

2016-07-12 Thread Berker Peksag

Berker Peksag added the comment:

logging module doesn't support Path objects. You need to wrap

STATUSLOG_PATH = Path('~/logFiles/Reseller/').expanduser()

with str().

We could possibly add PEP 519 support to the logging module for Python 3.6. 
What do you think, Vinay?

--
nosy: +berker.peksag, vinay.sajip

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27493] logging module fails with unclear error when supplied a (Posix)Path

2016-07-12 Thread Richard

New submission from Richard:

No idea if I should be reporting this here, but it came with the default 
installation, so here goes:

On a mac, I supplied a basicConfig object to the logging class that contains a 
PosixPath instance for the "filename" attribute.
consequently, it fails with the error message "'PosixPath' object has no 
attribute 'startswith'" without specifying where the issue lies.

offending value:
STATUSLOG_PATH   = Path('~/logFiles/Reseller/').expanduser()

Relevant part of the traceback (which didn't print by default):
  File 
"/Users/rhendrikse/Documents/PythonScripts/Reseller/Reseller/application/application.py",
 line 41, in __setup_logger
logging.basicConfig(level=logging.DEBUG, format=DEFS.RUNLOG_FORMAT, 
filename=DEFS.RUNLOG_PATH)
  File 
"/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/logging/__init__.py",
 line 1744, in basicConfig
h = FileHandler(filename, mode)
  File 
"/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/logging/__init__.py",
 line 998, in __init__
self.baseFilename = os.path.abspath(filename)
  File 
"/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/posixpath.py", 
line 357, in abspath
if not isabs(path):
  File 
"/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/posixpath.py", 
line 64, in isabs
return s.startswith(sep)
AttributeError: 'PosixPath' object has no attribute 'startswith'

--
components: Library (Lib)
messages: 270233
nosy: rhendrikse
priority: normal
severity: normal
status: open
title: logging module fails with unclear error when supplied a (Posix)Path
versions: Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com