This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mdengler
Recipients gvanrossum, mdengler, rhettinger, skip.montanaro, vimboss
Date 2014-10-09.12:57:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1412859461.83.0.910697366769.issue557704@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2014-10-09 12:57:41mdenglersetrecipients: + mdengler, gvanrossum, skip.montanaro, rhettinger, vimboss
2014-10-09 12:57:41mdenglersetmessageid: <1412859461.83.0.910697366769.issue557704@psf.upfronthosting.co.za>
2014-10-09 12:57:41mdenglerlinkissue557704 messages
2014-10-09 12:57:41mdenglercreate