In 110 main do config email config id config pass Nightwish In 111 uni

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
In [110]: a = main.do(config['email'], config['id'], config['pass'], 'Nightwish')
In [111]: x = unicode(a.read(),'cp1251')
In [112]: b = [x for x in x.split('\n') if 'performer' in x ][0]
In [113]: b
Out[113]: u' <b id="performer44757045">Nightwish</b> - <span id="title44757045">The Kinslayer</span> <small>(<a href=\'id4693902\'>\u0418. \u041a\u0430\u0440\u0442\u0430\u0448\u043e\u0432\u0430</a>)</small></div>'
In [114]: BeautifulSoup.BeautifulSoup(b)
Out[114]: ---------------------------------------------------------------------------
UnicodeEncodeError Traceback (most recent call last)
/home/a2k/prog/vkpleer/<ipython console> in <module>()
/usr/lib/python2.6/site-packages/IPython/Prompts.pyc in __call__(self, arg)
549
550 # and now call a possibly user-defined print mechanism
--> 551 manipulated_val = self.display(arg)
552
553 # user display hooks can change the variable to be stored in
/usr/lib/python2.6/site-packages/IPython/Prompts.pyc in _display(self, arg)
575 return IPython.generics.result_display(arg)
576 except TryNext:
--> 577 return self.shell.hooks.result_display(arg)
578
579 # Assign the default display method:
/usr/lib/python2.6/site-packages/IPython/hooks.pyc in __call__(self, *args, **kw)
139 #print "prio",prio,"cmd",cmd #dbg
140 try:
--> 141 ret = cmd(*args, **kw)
142 return ret
143 except ipapi.TryNext, exc:
/usr/lib/python2.6/site-packages/IPython/hooks.pyc in result_display(self, arg)
169
170 if self.rc.pprint:
--> 171 out = pformat(arg)
172 if '\n' in out:
173 # So that multi-line strings line up with the left column of
/usr/lib/python2.6/pprint.pyc in pformat(self, object)
109 def pformat(self, object):
110 sio = _StringIO()
--> 111 self._format(object, sio, 0, 0, {}, 0)
112 return sio.getvalue()
113
/usr/lib/python2.6/pprint.pyc in _format(self, object, stream, indent, allowance, context, level)
127 self._readable = False
128 return
--> 129 rep = self._repr(object, context, level - 1)
130 typ = _type(object)
131 sepLines = _len(rep) > (self._width - 1 - indent - allowance)
/usr/lib/python2.6/pprint.pyc in _repr(self, object, context, level)
221 def _repr(self, object, context, level):
222 repr, readable, recursive = self.format(object, context.copy(),
--> 223 self._depth, level)
224 if not readable:
225 self._readable = False
/usr/lib/python2.6/pprint.pyc in format(self, object, context, maxlevels, level)
233 and whether the object represents a recursive construct.
234 """
--> 235 return _safe_repr(object, context, maxlevels, level)
236
237
/usr/lib/python2.6/pprint.pyc in _safe_repr(object, context, maxlevels, level)
318 return format % _commajoin(components), readable, recursive
319
--> 320 rep = repr(object)
321 return rep, (rep and not rep.startswith('<')), False
322
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0418' in position 117: ordinal not in range(128)