Last modified: 2014-07-30 16:11:45 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T66958, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 64958 - representation string fails for page object
representation string fails for page object
Status: NEW
Product: Pywikibot
Classification: Unclassified
General (Other open bugs)
core-(2.0)
PC Windows 7
: Low normal
: ---
Assigned To: John Mark Vandenberg
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-05-06 17:02 UTC by xqt
Modified: 2014-07-30 16:11 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description xqt 2014-05-06 17:02:57 UTC
sample:

>>> import pwb
>>> import pywikibot as py
>>> s = py.Site('af')
>>> p = py.Page(s, 'user:xqt')
>>> p
Page(Gebruiker:Xqt)
>>> s = py.Site('fa')
>>> p = py.Page(s, 'user:xqt')
>>> p

Traceback (most recent call last):
  File "<pyshell#12>", line 1, in <module>
    p
  File "pywikibot\page.py", line 224, in __repr__
    self.title().encode(config.console_encoding))
  File "C:\Python27\lib\encodings\cp850.py", line 12, in encode
    return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-4: character maps to <undefined>
Comment 1 John Mark Vandenberg 2014-07-29 08:01:02 UTC
Taking as I've been working on this for a while due to the cache key bug.
Comment 2 John Mark Vandenberg 2014-07-30 16:10:45 UTC
We now have a test case for this in page_tests, which fails after a clean install of pywikibot.

One way to workaround this problem is to set the console codepage to 65001x

C:\pywikibot\core>chcp 65001
Active code page: 65001

And set pywikibot console_encoding = 'utf-8'

One my console, ar and fa doesnt display properly - boxes are used - but copying the console text does put the proper ar/fa text into the clipboard buffer.

However in pwb shell, 'print p' causes another exception.

>>> pywikibot.output(p)
Page(کاربر:John Vandenberg)
>>> p
Page(کاربر:John Vandenberg)Traceback (most recent call last):
  File "<console>", line 1, in <module>
IOError: [Errno 0] Error

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links