Re: [dabo-users] Fw: Unicode Encode Error

Author: Zdravko Subakov

Posted: 2012-04-20 at 15:19:30

If I got it correctly I should

add this line

from dabo.lib.utils import ustr

and comment out first(with minus) and add the second one (with plus)

txt = ed.Text

txt = ustr(ed.Text)

If that is what you wanted to try out it still does not work, here is the

error:

***********************

C:\dabo\ide>python editor.py

Traceback (most recent call last):

File

"C:\Python27\lib\site-packages\dabo-0.9.4-py2.7.egg\dabo\ui\uiwx\dMenuIte

m.py", line 58, in __onWxHit

self.raiseEvent(dEvents.Hit, evt)

File

"C:\Python27\lib\site-packages\dabo-0.9.4-py2.7.egg\dabo\ui\uiwx\dPemMixi

n.py", line 1045, in raiseEvent

super(dPemMixin, self).raiseEvent(eventClass, nativeEvent, *args,

**kwargs)

File

"C:\Python27\lib\site-packages\dabo-0.9.4-py2.7.egg\dabo\lib\eventMixin.p

y", line 81, in raiseEvent

bindingFunction(event)

File "editor.py", line 905, in onRunScript

f.write(txt)

UnicodeEncodeError: 'ascii' codec can't encode character u'\u017d' in

position 1

53: ordinal not in range(128)

*****************************

----- Original Message -----

From: "Paul McNett" <p@ulmcnett.com>

To: "Dabo Users list" <dabo-users@leafe.com>

Sent: Friday, April 20, 2012 9:56 PM

Subject: Re: [dabo-users] Fw: Unicode Encode Error

> Please try manually patching dabo/ide/Editor.py with these changes:

>

> Index: Editor.py

> ===================================================================

> --- Editor.py (revision 7134)

> +++ Editor.py (working copy)

> @@ -10,6 +10,7 @@

> import operator

> import dabo

> import dabo.dEvents as dEvents

> +from dabo.lib.utils import ustr

> from dabo.dLocalize import _

> _Use_Subprocess = True

> try:

> @@ -897,7 +898,7 @@

> fileDir = os.path.split(ed.FilePath)[0]

> if fileDir:

> os.chdir(fileDir)

> - txt = ed.Text

> + txt = ustr(ed.Text)

> fname = getTempFile(ext="py")

> f = open(fname, "w")

> f.write(txt)

>

_______________________________________________

Post Messages to: Dabo-users@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Searchable Archives: http://leafe.com/archives/search/dabo-users

This message: http://leafe.com/archives/byMID/A7B076A235C84365B40E9DD5B7B20E42@Perajoe

©2012 Zdravko Subakov