[python-win32] Re: UNICODE strings

Reuven Abliyev romerchat at hotmail.com
Thu Jul 24 14:00:09 EDT 2003


Here the code I'm using:

self.__rs.Open ("select CategoryID, CategoryName from Category;",
self.__conn, 1)
        lstCategoryNames=[]
        while not self.__rs.EOF:

lstCategoryNames.append((self.__rs.Fields("CategoryName").Value))
            self.__rs.MoveNext()

        wxStaticText(self, -1, "????", pos=(675,80))

        self.cbCategory = wxComboBox(self, wxNewId(), lstCategoryNames[0],
wxPoint(450,80), wxSize(220, -1),
                   lstCategoryNames, style=wxCB_READONLY | wxCB_DROPDOWN)

Here the FULL error screen

Traceback (most recent call last):
  File "C:\Documents and Settings\Owner\My
Documents\Reuven\Lessons\ExamTest.py"
, line 213, in ?
    pnlEditSong(frame, wxNewId())
  File "C:\Documents and Settings\Owner\My
Documents\Reuven\Lessons\ExamTest.py"
, line 67, in __init__
    lstCategoryNames, style=wxCB_READONLY | wxCB_DROPDOWN)
  File "C:\Python22\Lib\site-packages\wxPython\controls.py", line 330, in
__init
__
    self.this = apply(controlsc.new_wxComboBox,_args,_kwargs)
TypeError: Unable to convert string
12:58:51: Debug: e:\projects\wx\src\msw\app.cpp(439):
'UnregisterClass(canvas)'
failed with error 0x00000584 (class still has open windows.).




"Jens B. Jorgensen" <jens.jorgensen at tallan.com> wrote in message
news:3F1E9C62.9040904 at tallan.com...
> Your question is unfortunately too vague to tell you how to solve this.
> The error you're getting though is occuring because you're somehow
> (possibly inadvertently) converting a unicode string (returned from the
> recordset) into a "regular" (ascii) string.
>
> You probably shouldn't be doing the conversion at all since the data
> (hebrew) is not encodable in ascii. Since it is unclear how you're doing
> what it is your doing though it is hard to tell you how to get the
> combobox and not end up doing this ascii conversion. Perhaps you could
> post some code as well so we can see what's happening?
>
> Reuven Abliyev wrote:
>
> >I using ACCESS & ADO
> >Database contains some data in Hebrew
> >connect to DB - OK
> >getting Recordset  - OK
> >BUT
> >when I'm trying to load data I've got into COMBOBOX
> >I'm getting this message:
> >UnicodeError: ASCII encoding error: ordinal not in range(128)
> >
> >How can I solve this
> >
> >
> >
> >
> >_______________________________________________
> >Python-win32 mailing list
> >Python-win32 at python.org
> >http://mail.python.org/mailman/listinfo/python-win32
> >
> >
>
> -- 
> Jens B. Jorgensen
> jens.jorgensen at tallan.com
>
> "With a focused commitment to our clients and our people, we deliver value
through customized technology solutions"






More information about the Python-win32 mailing list