Martin Dengler added the comment:
I know this is ancient, but the below patch handles spaces in passwords in
2.7.8 and 3.4 for me. If this is worth making into a new bug / proper patch
I'm happy to do it.
$ diff -uw /c/Python278/Lib/netrc.py{-orig,}
--- /c/Python278/Lib/netrc.py-orig 2014-10-09 13:52:36.995286000 +0100
+++ /c/Python278/Lib/netrc.py 2014-10-09 13:53:05.041286000 +0100
@@ -111,7 +111,23 @@
"~/.netrc access too permissive: access"
" permissions must restrict access to only"
" the owner", file, lexer.lineno)
+ # handle passwords with quoted spaces
+ quote_chars = lexer.quotes
+ removed_chars = []
+ for quote_char in quote_chars:
+ if quote_char in lexer.wordchars:
+ lexer.wordchars =
lexer.wordchars.replace(quote_char, '')
+ removed_chars.append(quote_char)
+ try:
+
password = lexer.get_token()
+
+ for quote_char in quote_chars:
+ if password.startswith(quote_char) and
password.endswith(quote_char):
+ password = password[1:-1]
+ finally:
+ for removed_char in removed_chars:
+ lexer.wordchars += removed_char
else:
raise NetrcParseError("bad follower token %r" % tt,
file, lexer.lineno)
----------
nosy: +mdengler
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue557704>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com