https://bugzilla.wikimedia.org/show_bug.cgi?id=55173

       Web browser: ---
            Bug ID: 55173
           Summary: Line ending inconsistency when using XmlReader
           Product: Pywikibot
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: General
          Assignee: [email protected]
          Reporter: [email protected]
    Classification: Unclassified
   Mobile Platform: ---

Originally from: http://sourceforge.net/p/pywikipediabot/bugs/1508/
Reported by: Anonymous user
Created on: 2012-08-31 19:08:06
Subject: Line ending inconsistency when using XmlReader
Original description:
The following example explains it all:

import wikipedia
p = wikipedia.Page\(wikipedia.getSite\(\), "User:WGH"\)
wikipedia.getall\(wikipedia.getSite\(\), \[p\]\) 
print "\r\n" in p.get\(\) \# True \(using Special:Export and, in turn,
xmlreader\)
print "\r\n" in p.get\(force=True\) \# False \(direct api\)

It's caused by xmlreader replacing \n with \r\n for some reason. I suggest
removing it altogether, because in Pyhon universal newlines are ususally used.
Also \r\n line endings confuse mwlib parser.
Patch:
https://sourceforge.net/tracker/?func=detail&aid=3563805&group\_id=93107&atid=603140

% python version.py
Pywikipedia trunk/pywikipedia/ \(r10511, 2012/08/30, 20:40:38\)
Python 2.7.3 \(default, Aug 31 2012, 16:05:44\)
\[GCC 4.2.1 20070831 patched \[FreeBSD\]\]
config-settings:
use\_api = True
use\_api\_login = True
unicode test: ok

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to