[pygtk] TextBuffer, Python 3 and UTF-8
Hi, I'm migrating an application to Python 3, GTK+ 3 and the PyGI bindings. I'm having trouble inserting non-ASCII text to a Gtk.TextBuffer. Here's a minimal example. #!/usr/bin/env python3 from gi.repository import Gtk text_view = Gtk.TextView() text_buffer = text_view.get_buffer() text_buffer.set_text("åäö") text_buffer.insert_at_cursor("åäö") window = Gtk.Window() window.add(text_view) window.resize(500, 500) window.show_all() window.connect("delete-event", Gtk.main_quit) Gtk.main() The 'set_text' call seems to always succeed, but the the following 'insert_at_cursor' call fails with Gtk-CRITICAL **: gtk_text_buffer_emit_insert: assertion `g_utf8_validate (text, len, NULL)' failed The same is true of the other 'insert_*' methods. Strangely trying to insert "åäö." instead of "åäö" doesn't give a warning, but doesn't insert the period. Is this related to the string type changes in Python 2->3? Can I expect Python 3 and non-ASCII text to work in general with PyGI? I'm using Python 3.2 and PyGObject 2.28.6 on Debian unstable/experimental. -- Osmo Salomaa ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
Re: [pygtk] Windows all in one bundle broken?
On 22/07/2011 22:34, Mathew Yeates wrote: >> >> We'll need a bit more information to be able to help you: >> >> 1) How do you execute glade-3.exe? Via the shortcut the installer >> created in the start menu or some other method? > > No item was added to the Start Menu. Glade-3.6 is still shown though. > Should I uninstall the old Glade? That's strange. There should be an entry like this: https://github.com/dieterv/pygtk-installer/wiki/screenshots/2.22.4/5-programmenu.png >> 2) What does your PATH environment variable look like? > open a >> "Command Prompt" aka cmd.exe and execute "echo %PATH%" > > It's pretty long. I'll post it last > Here is my path > C:\l1b\src\l1b32\Debug;c:\Python27;C:\Python26\Lib\site-packages\PyQt4;C:\WINDOW > S\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\Program Files > (x86)\SlikSvn\bi > n\;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program > Files > (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files > (x86)\Mercurial;C:\Pyt > hon25\DLLs;C:\Program Files (x86)\GTK2-Runtime\bin;C:\Program Files > (x86)\Ration > al\common;c:\Python27;C:\Python-2.7.1\PC\VS7.1;C:\l1b\src\l1b32\Debug;c:\Python2 > 7;C:\Python26\Lib\site-packages\PyQt4;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\ > system32\WBEM;C:\Program Files (x86)\SlikSvn\bin\;c:\Program Files > (x86)\Microso > ft SQL Server\100\Tools\Binn\;c:\Program Files (x86)\Microsoft SQL > Server\100\DT > S\Binn\;C:\Program Files (x86)\Mercurial;C:\Python25\DLLs;C:\Program Files > (x86) > \GTK2-Runtime\bin;C:\Program Files > (x86)\IBM\RationalPurifyPlus\Common;C:\l1b\sr > c\l1b32\Debug;c:\g77\bin;C:\Program Files\MySQL\MySQL Server > 5.1\bin;c:\python27 > ;c:\python26;C:\Python25;C:\Python25\Scripts;C:\Program Files > (x86)\Gtk+\bin;C:\ > Program Files (x86)\CVSNT\;C:\abs\bin;C:\Program Files (x86)\GIMP-2.0\bin Don't see anything too weird in there. >> 3) Where is Python 2.7 installed? > c:\Python27 > >> 4) Assuming Python 2.7 is installed in C:\Python27, does >> C:\Python27\Lib\site-packages\gtk-2.0\runtime\bin actually >> contain glade-3.exe? > > yes. > >> 5) Open the attached clean.py script in your favorite text editor >> and edit the paths on line 7 and 8 to correspond to the values >> applicable on your system. Then run the script. Does the script >> output any values? > > Nope. > > btw, I run glade by typing .\glade-3.exe in the directory > C:\Python27\Lib\site-packages\gtk-2.0\runtime\bin > > producing "The system cannot execute the specified program." Looks good. Next step: - launch a "Command Prompt" (aka cmd.exe) - start depends.exe [1] from the "Command Prompt", for example type C:\depends.exe and then hit the return or enter key - File>Open>"C:\Python27\Lib\site-packages\gtk-2.0\runtime\bin\glade-3.exe" - hit F7 - check all the checkboxes - click "OK" - Glade now starts. And will crash like you've described above - Back in Dependency Walker click File>Save As...>glade-3.dwi - Upload the (compressed!) glade-3.dwi file somewhere and let us know where we can get it or mail the file directly to me (don't try to post it on the mailinglist, you message will be rejected due to the attachment being too big...) mvg, Dieter [1] http://www.dependencywalker.com/depends22_x86.zip ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/