Movatterモバイル変換


[0]ホーム

URL:


homepage

Message300860

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Authorzmwangx
Recipientszmwangx
Date2017-08-26.01:50:51
SpamBayes Score-1.0
Marked as misclassifiedYes
Message-id<1503712252.67.0.949610477917.issue31281@psf.upfronthosting.co.za>
In-reply-to
Content
Consider    import fileinput    import pathlib    with fileinput.input(files=(pathlib.Path('in.txt'),), inplace=True) as fp:        for line in fp:            print(line, end='')which results in    Traceback (most recent call last):      File "./pathlib-fileinput.py", line 6, in <module>        for line in fp:      File "/Users/zmwang/.pyenv/versions/3.6.1/lib/python3.6/fileinput.py", line 250, in __next__        line = self._readline()      File "/Users/zmwang/.pyenv/versions/3.6.1/lib/python3.6/fileinput.py", line 331, in _readline        self._filename + (self._backup or ".bak"))    TypeError: unsupported operand type(s) for +: 'PosixPath' and 'str'A trivial fix is converting the specified filename to str when assigning to self._filename:    -        self._filename = self._files[0]    +        self._filename = str(self._files[0])
History
DateUserActionArgs
2017-08-26 01:50:52zmwangxsetrecipients: +zmwangx
2017-08-26 01:50:52zmwangxsetmessageid: <1503712252.67.0.949610477917.issue31281@psf.upfronthosting.co.za>
2017-08-26 01:50:52zmwangxlinkissue31281 messages
2017-08-26 01:50:51zmwangxcreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp