Closed tolomea closed 12 years ago
Hmmm... I searched a little bit: http://stackoverflow.com/questions/6079685/what-is-wrong-with-my-windows-gtk-for-python-installation Have you tried this so far? Because I have no Windows 7 installation at the moment I can't test this my self.
Yeah, and various other variations on that theme, none of which helped, although remarkably I don't seem to have broken my system yet. Perhaps I should give up and setup a linux virtual machine.
The odd thing and what I suspect is the key to this mess, is that I can import gtk from the python prompt with no problems. It's only when running your setup.py that it fails.
It seems to be the import of enchant, if I comment that out of init.py then the setup install runs and I fail at runtime with:
Traceback (most recent call last):
File "main.py", line 12, in
putting the enchant import after the gtk import has the same effect as commenting it out, specifically the languages import error above, here's the enchant version if that helps any
C:\code\blog>python Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.
import enchant enchant.version '1.6.5'
If you are using the newest version, there was an API change. There is no language list and language_exists on module level anymore. Please check the documentation http://koehlma.github.com/pygtkspellcheck/ or the new example. There is a languages attribute for every SpellCheck instance because the list can vary if you set for example a different dictionary directory for each enchant.Broker. So, adapt your application and try it again with the enchant import behind the gtk import. What happens?
Yeah, that got me past the pygtkspellcheck specific problems, now I'm just bashing up against not having gi.repository which has broken all of my code. I'm not clear why I don't have that or even if I'm supposed to have it, do you know anything about gi.repository on windows?
There is no GObject-Introspection for windows yet. (Except if you use Cygwin - if I remember right)
You have to backport your application to PyGTK. Indeed you have to maintain 3 versions of your application - like pygtkspellcheck does. PyGTK with Gtk 2, GObject-Introspection with Gtk 2 and GObject-Introspection with Gtk 3.
awesome, that's going to be a touch tedious, thanks for the help, I'll let you know how it goes
I fixed the import issue, now you only have to backport your application - good luck
I have the backport done and everything seems to be working fine, including the spell checking. Having done my backport I'm curious about a couple of things in yours.
if _gobject:
menu = gtk.Menu.new()
else:
menu = gtk.Menu()
Under gobject I don't use the new function in places like this, I just call the default constructor, so I don't need the if statement at all, is this required for a gobject 2/3 difference? or is it redundant?
window = gtk.Window.new(gtk.WindowType(0))
Why is the gtk.WINDOW_TOPLEVEL constant not used here instead of the explicit 0?
btw, thanks for your help and for creating the spellchecker in the first place
I think code says more than thousand words:
if _gobject:
menu = gtk.Menu.new()
else:
menu = gtk.Menu()
>>> gtk.Window(gtk.WindowType.TOPLEVEL)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: GObject.__init__() takes exactly 0 arguments (1 given)
>>> gtk.Window.new(gtk.WindowType.TOPLEVEL)
<Window object at 0x1e3fe60 (GtkWindow at 0x1ecf090)> >>> gtk.Window(gtk.WindowType.TOPLEVEL)
(the new method is like the original C method - http://developer.gnome.org/gtk3/stable/ - sometimes it works without new and sometimes not, so I decided to use new everytime)
There is no gtk.WINDOW_TOPLEVEL constant over gi.repository.
>>> gtk.WINDOW_TOPLEVEL
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.2/site-packages/gi/module.py", line 243, in __getattr__
return getattr(self._introspection_module, name)
File "/usr/lib/python3.2/site-packages/gi/module.py", line 105, in __getattr__
self.__name__, name))
AttributeError: 'gi.repository.Gtk' object has no attribute 'WINDOW_TOPLEVEL'
>>> gtk.WindowType(0)
<enum GTK_WINDOW_TOPLEVEL of type GtkWindowType>
But I think I could use gtk.WindowType.TOPLEVEL instead (or do you mean this by gtk.WINDOW_TOPLEVEL).
(the new method is like the original C method - http://developer.gnome.org/gtk3/stable/ - sometimes it works without new and sometimes not, so I decided to use new everytime)
I understand that reasoning, I took the opposite approach of only using new where it was required in order to minimise the number of places where I switch on _gobject
gtk.WINDOW_TOPLEVEL
I may have confused things here, this was not about sharing code between gobject and gtk, it was purely about gtk style, I see you've changed it now.
On Fri, Jun 15, 2012 at 6:06 PM, koehlma < reply@reply.github.com
wrote:
I think code says more than thousand words:
if _gobject: menu = gtk.Menu.new() else: menu = gtk.Menu()
gtk.Window(gtk.WindowType.TOPLEVEL) Traceback (most recent call last): File "
", line 1, in TypeError: GObject.init() takes exactly 0 arguments (1 given) gtk.Window.new(gtk.WindowType.TOPLEVEL) <Window object at 0x1e3fe60 (GtkWindow at 0x1ecf090)> >>> gtk.Window(gtk.WindowType.TOPLEVEL) (the new method is like the original C method - http://developer.gnome.org/gtk3/stable/ - sometimes it works without new and sometimes not, so I decided to use new everytime)
There is no gtk.WINDOW_TOPLEVEL constant over gi.repository.
gtk.WINDOW_TOPLEVEL Traceback (most recent call last): File "
", line 1, in File "/usr/lib/python3.2/site-packages/gi/module.py", line 243, in getattr return getattr(self._introspection_module, name) File "/usr/lib/python3.2/site-packages/gi/module.py", line 105, in getattr self.name, name)) AttributeError: 'gi.repository.Gtk' object has no attribute 'WINDOW_TOPLEVEL' gtk.WindowType(0) But I think I could use gtk.WindowType.TOPLEVEL instead (or do you mean this by gtk.WINDOW_TOPLEVEL).
Reply to this email directly or view it on GitHub: https://github.com/koehlma/pygtkspellcheck/issues/5#issuecomment-6361547
Trying to install this on a win7 machine I get the following stack:
$ python setup.py install Traceback (most recent call last): File "setup.py", line 20, in
from gtkspellcheck import version
File "c:\code\pygtkspellcheck\src\gtkspellcheckinit.py", line 37, in
import gtk
File "c:\python27\lib\site-packages\gtk-2.0\gtkinit.py", line 30, in
import gobject as _gobject
File "c:\python27\lib\site-packages\gtk-2.0\gobjectinit.py", line 26, in
from glib import spawn_async, idle_add, timeout_add, timeout_add_seconds, \
File "c:\python27\lib\site-packages\gtk-2.0\glibinit.py", line 22, in
from glib._glib import *
ImportError: DLL load failed: The specified procedure could not be found.
here's some version info
$ python Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win 32 Type "help", "copyright", "credits" or "license" for more information.
Any suggestions about what might be going wrong?