Author: Zdravko Subakov
Posted: 2012-04-20 at 17:34:23
Ok guys I think I am onto something
I serched a bit web for encoding and file writes and got a couple of good
posts about errors when using unicode in command line versus not when runing
through an IDE.
They suggested trying this in command line
import sys
print sys.getdefaultencoding()
and the result was ascii which might be a problem
the suggested solution was to use codecs so I did that
in the begining of the Editor.py after other import statments I added
import codecs
and instead of f=open(fname, "wb")
I put
f=codecs.open(fname,"wb","utf-8")
saved and run python Editor.py and in editor loaded my HW script and run it
and... for the first time it was not stuck, there is no error.
The form is shown and the label as well, but its not Z its some kind of L' "
so I made a step, I would say in good direction, but as newbie in Python I
would rather leave it to you guys.
And beside its half past midnight here so its time to go to bed.
I ll wait a couple of minutes if you have anything urgent, otherwise we can
continue tomorow.
Regards Z.
----- Original Message -----
From: "Zdravko Subakov" <zdravko@subakov.com>
To: "Dabo Users list" <dabo-users@leafe.com>
Sent: Friday, April 20, 2012 11:48 PM
Subject: Re: [dabo-users] Fw: Unicode Encode Error
> ok I commented the line and added changed line below it, reinastalled dabo
> and tried HW app and it failed.
> ***************
> 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 906, in onRunScript
> f.write(txt)
> UnicodeEncodeError: 'ascii' codec can't encode character u'\u017d' in
> position 1
> 53: ordinal not in range(128)
> *****************
> Z.
>
>
>
> ----- Original Message -----
> From: "Paul McNett" <p@ulmcnett.com>
> To: "Dabo Users list" <dabo-users@leafe.com>
> Sent: Friday, April 20, 2012 11:39 PM
> Subject: Re: [dabo-users] Fw: Unicode Encode Error
>
>
>> Okay please try one more thing. See the line above 905 that says:
>> f = open(fname, "w")
>>
>> Change to:
>> f = open(fname, "wb")
>>
>> Paul
>>
>>
>
> _______________________________________________
> 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/DCA10AD04700417CBC4DEE9AD8FD6F25@Perajoe
>
_______________________________________________
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/C056DD3FBA4A4F80A95B8B16B7711313@Perajoe