I’m trying to run a Python 2.7 script I developed on a Windows 7 x64 machine on a windows XP SP3 laptop. It relies on wx, wx.lib.wxcairo, rsvg, and cairo. All of the imports finish successfully. On the XP machine, wx.GraphicsRenderer.GetCairoRenderer()
returns None rather than “<wx._gdi.GraphicsRenderer; proxy of <Swig Object of type ‘wxGraphicsRenderer *’ at 0x2ff21c0> >”. When the script starts, it shows a gray window with a color-gradient circle in the upper left. There’s also a Pango warning, but I
think that’s simply a missing font.
I installed the pygtk2 all-in-one version 2.24.2 (http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.24/) and wxPython2.8 unicode (http://www.wxpython.org/download.php#stable ).
I can see the dlls for cairo, pnglib, and zlib in C:\Python27\Lib\site-packages\gtk-2.0\runtime\bin, and C:\Python27\Lib\site-packages is in my path. The only difference I can see in the packages is that the Windows 7 machine has pycairo 1.10.0 shown from
pip freeze, while the XP machine has pycairo 1.8.10. They both have pygtk 2.24.0, pygobject 2.28.3, pyrsvg 2.23.1.
Is there anything I can do to figure out where the missing dependency is?
I’m trying to run a Python 2.7 script I developed on a Windows 7 x64 machine on a windows XP SP3 laptop. It relies on wx, wx.lib.wxcairo, rsvg, and cairo. All of the imports finish successfully. On the XP machine, wx.GraphicsRenderer. GetCairoRenderer()
returns None rather than “<wx._gdi.GraphicsRenderer; proxy of <Swig Object of type ‘wxGraphicsRenderer *’ at 0x2ff21c0> >”. When the script starts, it shows a gray window with a color-gradient circle in the upper left. There’s also a Pango warning, but I
think that’s simply a missing font.
I installed the pygtk2 all-in-one version 2.24.2 (http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.24/) and wxPython2.8 unicode (http://www.wxpython.org/download.php#stable ).
I can see the dlls for cairo, pnglib, and zlib in C:\Python27\Lib\site-packages\ gtk-2.0\runtime\bin, and C:\Python27\Lib\site-packages is in my path. The only difference I can see in the packages is that the Windows 7 machine has pycairo 1.10.0 shown from
pip freeze, while the XP machine has pycairo 1.8.10. They both have pygtk 2.24.0, pygobject 2.28.3, pyrsvg 2.23.1.
Is there anything I can do to figure out where the missing dependency is?
Sure… I still run XP half of the time. I don’t have pygobject or pyrsvg installed but here is a start…
Also I didn’t install cairo/pycairo from pip. pip seems to fail most of the time for me, so I just use setuptools “python setup.py install”
Also not sure what a “Pango” warning is…
Figure out what you are trying to do/or fix specifically.
First add some code…
raw_input(‘Press Enter To Continue…’)
at various places in your program. After imports, somewhere in the startupcode for debuging, and one at the end.
Make sure your program’s wx.App(0). redirect=False
Go to your start menu and use “Run…” Type in ‘cmd’. This will open a command prompt.
CD (call directory) to your program directory in the command prompt.
Type “python MyApp.py” or “python -d MyApp.py” into the command prompt. This will fire up the program with the command prompt open so you can see what is going on. If it is a recursion problem, you can kill the process and move the statement nearer to the problem to pinpoint it.
When the command prompt asks the question click on it and press Enter to continue… Continue this behavior until your program crashes.
There will be a Traceback in the command prompt. Click back focus over to it.
Right click in the command prompt. this will open a context menu. SelectAll. Then press Enter(Copy Shortcut). Paste that into notepad or a txt file.
If the debug output doesn’t help finding the problem right off, consider posting the debug or (short program as an attachment) here.
If debug helps, fix problem and remove debug prints.
···
On Wednesday, September 18, 2013 3:26:25 PM UTC-5, Louis Simons wrote:
I’m trying to run a Python 2.7 script I developed on a Windows 7 x64 machine on a windows XP SP3 laptop. It relies on wx, wx.lib.wxcairo, rsvg, and cairo. All of the imports finish successfully. On the XP machine, wx.GraphicsRenderer. GetCairoRenderer()
returns None rather than “<wx._gdi.GraphicsRenderer; proxy of <Swig Object of type ‘wxGraphicsRenderer *’ at 0x2ff21c0> >”. When the script starts, it shows a gray window with a color-gradient circle in the upper left. There’s also a Pango warning, but I
think that’s simply a missing font.
I installed the pygtk2 all-in-one version 2.24.2 (http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.24/) and wxPython2.8 unicode (http://www.wxpython.org/download.php#stable ).
I can see the dlls for cairo, pnglib, and zlib in C:\Python27\Lib\site-packages\ gtk-2.0\runtime\bin, and C:\Python27\Lib\site-packages is in my path. The only difference I can see in the packages is that the Windows 7 machine has pycairo 1.10.0 shown from
pip freeze, while the XP machine has pycairo 1.8.10. They both have pygtk 2.24.0, pygobject 2.28.3, pyrsvg 2.23.1.
Is there anything I can do to figure out where the missing dependency is?
Sure… I still run XP half of the time. I don’t have pygobject or pyrsvg installed but here is a start…
Just for clarification, you’re running wxPython with cairo/pycairo? That would be great to know because at least that means it’s possible.
Also I didn’t install cairo/pycairo from pip. pip seems to fail most of the time for me, so I just use setuptools “python setup.py install”
Also not sure what a “Pango” warning is…
I fixed the Pango warning by making sure that I was using a font available to the system in my SVG file.
Figure out what you are trying to do/or fix specifically.
First add some code…
raw_input(‘Press Enter To Continue…’)
at various places in your program. After imports, somewhere in the startupcode for debuging, and one at the end.
Make sure your program’s wx.App(0). redirect=False
Go to your start menu and use “Run…” Type in ‘cmd’. This will open a command prompt.
CD (call directory) to your program directory in the command prompt.
Type “python MyApp.py” or “python -d MyApp.py” into the command prompt. This will fire up the program with the command prompt open so you can see what is going on. If it is a recursion problem, you can kill the process and move the statement nearer to the problem to pinpoint it.
When the command prompt asks the question click on it and press Enter to continue… Continue this behavior until your program crashes.
There will be a Traceback in the command prompt. Click back focus over to it.
Right click in the command prompt. this will open a context menu. SelectAll. Then press Enter(Copy Shortcut). Paste that into notepad or a txt file.
If the debug output doesn’t help finding the problem right off, consider posting the debug or (short program as an attachment) here.
If debug helps, fix problem and remove debug prints.
I’m pretty familiar with debugging via print statements. That was how I tracked it down to a failure of the wx.GraphicsRenderer.GetCairoRenderer() to return the Swig wxGraphicsRenderer. I was more wondering if there is a way to get Swig to tell you what dll it’s missing, or where it’s looking. With a simpler test case (the code from http://wiki.wxpython.org/UsingCairoTheEasyWay), the program is crashing at cr = wx.lib.wxcairo.ContextFromDC(dc) (line 25).
I think the cleanest thing might be to remove my entire python 2.7 install. Where did you find your copy of cairo/pycairo to install? Did you have to compile?
···
On Wednesday, September 18, 2013 9:11:50 PM UTC-4, Metallicow wrote:
On Wednesday, September 18, 2013 3:26:25 PM UTC-5, Louis Simons wrote:
In order to provide something that might be easier for others to replicate, I uninstalled Python 2.7 from the Windows XP SP3 machine (and deleted the C:\Python27) folder for good measure. I think did the following:
Added C:\Python27\Lib\site-packages\wx-2.9.5-msw\wx to my path (since that has the cairo dlls installed by wxPython).
Now, when I run the Cairo.py demo in the docs-demos package, all the dependencies are met, the demo window is drawn, and the python process immediately crashes before drawing anything. I believe this means the dlls are found, since I received a no dll available message before I added their install location to my path. In Cairo.py, the offending line is ctx = wx.lib.wxcairo.COntextFromDC(dc) (line 47). It results in the standard windows error/problem report form.
Is it possible that I have the wrong dlls for the system? Is there a way to check?
···
On Thursday, September 19, 2013 9:38:39 AM UTC-4, Louis Simons wrote:
On Wednesday, September 18, 2013 9:11:50 PM UTC-4, Metallicow wrote:
On Wednesday, September 18, 2013 3:26:25 PM UTC-5, Louis Simons wrote:
I’m trying to run a Python 2.7 script I developed on a Windows 7 x64 machine on a windows XP SP3 laptop. It relies on wx, wx.lib.wxcairo, rsvg, and cairo. All of the imports finish successfully. On the XP machine, wx.GraphicsRenderer. GetCairoRenderer()
returns None rather than “<wx._gdi.GraphicsRenderer; proxy of <Swig Object of type ‘wxGraphicsRenderer *’ at 0x2ff21c0> >”. When the script starts, it shows a gray window with a color-gradient circle in the upper left. There’s also a Pango warning, but I
think that’s simply a missing font.
I installed the pygtk2 all-in-one version 2.24.2 (http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.24/) and wxPython2.8 unicode (http://www.wxpython.org/download.php#stable ).
I can see the dlls for cairo, pnglib, and zlib in C:\Python27\Lib\site-packages\ gtk-2.0\runtime\bin, and C:\Python27\Lib\site-packages is in my path. The only difference I can see in the packages is that the Windows 7 machine has pycairo 1.10.0 shown from
pip freeze, while the XP machine has pycairo 1.8.10. They both have pygtk 2.24.0, pygobject 2.28.3, pyrsvg 2.23.1.
Is there anything I can do to figure out where the missing dependency is?
Sure… I still run XP half of the time. I don’t have pygobject or pyrsvg installed but here is a start…
Just for clarification, you’re running wxPython with cairo/pycairo? That would be great to know because at least that means it’s possible.
Also I didn’t install cairo/pycairo from pip. pip seems to fail most of the time for me, so I just use setuptools “python setup.py install”
Also not sure what a “Pango” warning is…
I fixed the Pango warning by making sure that I was using a font available to the system in my SVG file.
Figure out what you are trying to do/or fix specifically.
First add some code…
raw_input(‘Press Enter To Continue…’)
at various places in your program. After imports, somewhere in the startupcode for debuging, and one at the end.
Make sure your program’s wx.App(0). redirect=False
Go to your start menu and use “Run…” Type in ‘cmd’. This will open a command prompt.
CD (call directory) to your program directory in the command prompt.
Type “python MyApp.py” or “python -d MyApp.py” into the command prompt. This will fire up the program with the command prompt open so you can see what is going on. If it is a recursion problem, you can kill the process and move the statement nearer to the problem to pinpoint it.
When the command prompt asks the question click on it and press Enter to continue… Continue this behavior until your program crashes.
There will be a Traceback in the command prompt. Click back focus over to it.
Right click in the command prompt. this will open a context menu. SelectAll. Then press Enter(Copy Shortcut). Paste that into notepad or a txt file.
If the debug output doesn’t help finding the problem right off, consider posting the debug or (short program as an attachment) here.
If debug helps, fix problem and remove debug prints.
I’m pretty familiar with debugging via print statements. That was how I tracked it down to a failure of the wx.GraphicsRenderer.GetCairoRenderer() to return the Swig wxGraphicsRenderer. I was more wondering if there is a way to get Swig to tell you what dll it’s missing, or where it’s looking. With a simpler test case (the code from http://wiki.wxpython.org/UsingCairoTheEasyWay), the program is crashing at cr = wx.lib.wxcairo.ContextFromDC(dc) (line 25).
I think the cleanest thing might be to remove my entire python 2.7 install. Where did you find your copy of cairo/pycairo to install? Did you have to compile?
Let me clue you in on a reqular whooops act by many individuals. When uninstalling anything “python related” uninstall everything but python first, then python last. Preferably in the reverse order you installed then is best. WB Exp
I think this has to do with registry/other issues.
WryeBashWB Teaches manual install always as if you actually did it. Even tho it may be a Wizard Install(scripted).
Assuming a new VM… WinXP SP3
First install python 2.9.5 and optionally(the doc and demo)… for proofing.
Depending on if you have legit installers(manually, not pip), install them manually or copy the imported stuff dir(from the source) to site-packages,
I find the gimp/“pygtk-all-in-one-2.24.2.win32-py2.7.msi”", to work fine for my purposes, so install that with default specs. This should deal with anything cairo/gimp related.
Make sure “site-packages” is in your environment Variable(right click My Computer… navigate to env vars… edit, Ok, Close.)
Up until now you have not upgraded cairo, Do that manually now.
Try to run your application again.
we’ll proceed from here…
···
On Thursday, September 19, 2013 12:43:17 PM UTC-5, Louis Simons wrote:
In order to provide something that might be easier for others to replicate, I uninstalled Python 2.7 from the Windows XP SP3 machine (and deleted the C:\Python27) folder for good measure. I think did the following:
Added C:\Python27\Lib\site-packages\wx-2.9.5-msw\wx to my path (since that has the cairo dlls installed by wxPython).
Now, when I run the Cairo.py demo in the docs-demos package, all the dependencies are met, the demo window is drawn, and the python process immediately crashes before drawing anything. I believe this means the dlls are found, since I received a no dll available message before I added their install location to my path. In Cairo.py, the offending line is ctx = wx.lib.wxcairo.COntextFromDC(dc) (line 47). It results in the standard windows error/problem report form.
I think after all that it was the upgraded cairo causing troubles on XP. I uninstalled everything in reverse order, though there was some tactful deleting since the installers didn’t all have uninstallers. Is the standard procedure to delete the appropriate folder in site-packages?
The correct installation order was Python 2.7.5, wxPython 2.9.5.0, then GTK all-in-one 2.24.2. This allows the Cairo.py demo to run successfully. Just for confirmation, I then upgraded cairo to 1.10.0, which broke it, then went through the whole thing again.
Thanks,
Louis
···
On Thursday, September 19, 2013 2:57:17 PM UTC-4, Metallicow wrote:
On Thursday, September 19, 2013 12:43:17 PM UTC-5, Louis Simons wrote:
In order to provide something that might be easier for others to replicate, I uninstalled Python 2.7 from the Windows XP SP3 machine (and deleted the C:\Python27) folder for good measure. I think did the following:
Added C:\Python27\Lib\site-packages\wx-2.9.5-msw\wx to my path (since that has the cairo dlls installed by wxPython).
Now, when I run the Cairo.py demo in the docs-demos package, all the dependencies are met, the demo window is drawn, and the python process immediately crashes before drawing anything. I believe this means the dlls are found, since I received a no dll available message before I added their install location to my path. In Cairo.py, the offending line is ctx = wx.lib.wxcairo.COntextFromDC(dc) (line 47). It results in the standard windows error/problem report form.
Let me clue you in on a reqular whooops act by many individuals. When uninstalling anything “python related” uninstall everything but python first, then python last. Preferably in the reverse order you installed then is best. WB Exp
I think this has to do with registry/other issues.
WryeBashWB Teaches manual install always as if you actually did it. Even tho it may be a Wizard Install(scripted).
Assuming a new VM… WinXP SP3
First install python 2.9.5 and optionally(the doc and demo)… for proofing.
Depending on if you have legit installers(manually, not pip), install them manually or copy the imported stuff dir(from the source) to site-packages,
I find the gimp/“pygtk-all-in-one-2.24.2.win32-py2.7.msi”", to work fine for my purposes, so install that with default specs. This should deal with anything cairo/gimp related.
Make sure “site-packages” is in your environment Variable(right click My Computer… navigate to env vars… edit, Ok, Close.)
As far as Uninstalling, you can do it anyway you want, but note the best way is to uninstall in the reverse order that you installed them in. If you installed something with a installer, then perhaps the uninstaller will uninstall everything correctly and deal with the registry issues correctly(depends on the person who wrote the uninstaller).
If you installed it manually from source or whatever, then there is no registry edits, unless you made them yourself. In these cases, Yes, just deleting the folder/directory from site-packages is fine.
Hope that helps.
Also, CCleaner does a quick and good job of general cleanup and registry edits if you use installers.
···
On Friday, September 20, 2013 8:14:55 AM UTC-5, Louis Simons wrote:
I think after all that it was the upgraded cairo causing troubles on XP. I uninstalled everything in reverse order, though there was some tactful deleting since the installers didn’t all have uninstallers. Is the standard procedure to delete the appropriate folder in site-packages?
The correct installation order was Python 2.7.5, wxPython 2.9.5.0, then GTK all-in-one 2.24.2. This allows the Cairo.py demo to run successfully. Just for confirmation, I then upgraded cairo to 1.10.0, which broke it, then went through the whole thing again.
I think after all that it was the upgraded cairo causing troubles on XP.
I uninstalled everything in reverse order, though there was some tactful
deleting since the installers didn't all have uninstallers. Is the
standard procedure to delete the appropriate folder in site-packages?
The correct installation order was Python 2.7.5, wxPython 2.9.5.0, then
GTK all-in-one 2.24.2. This allows the Cairo.py demo to run
successfully. Just for confirmation, I then upgraded cairo to 1.10.0,
which broke it, then went through the whole thing again.
Which versions of Cairo and PyCairo are included in the all-in-one? When you updated cairo did you also use a newer version of PyCairo? If so then the crash is probably due to something in the code in wx.lib.wxcairo which sets up the ctypes info for the PyCairo C API structure. (Look at the end of the wxcairo.py file.) They keep adding things to the middle of the structure instead of to the end, which breaks backwards compatibility and we have to adjust the structure information in our module. However I thought that we had worked out what it needed to be be for 1.10.0, if you could experiment with changes to _fields to make it work with cairo 1.10.0 (and a PyCairo built for 1.10.0) and send a patch it would be appreciated.
On Wednesday, September 25, 2013 2:22:04 PM UTC-5, Robin Dunn wrote:
Louis Simons wrote:
I think after all that it was the upgraded cairo causing troubles on XP.
I uninstalled everything in reverse order, though there was some tactful
deleting since the installers didn’t all have uninstallers. Is the
standard procedure to delete the appropriate folder in site-packages?
The correct installation order was Python 2.7.5, wxPython 2.9.5.0, then
GTK all-in-one 2.24.2. This allows the Cairo.py demo to run
successfully. Just for confirmation, I then upgraded cairo to 1.10.0,
which broke it, then went through the whole thing again.
Which versions of Cairo and PyCairo are included in the all-in-one? When
you updated cairo did you also use a newer version of PyCairo? If so
then the crash is probably due to something in the code in
wx.lib.wxcairo which sets up the ctypes info for the PyCairo C API
structure. (Look at the end of the wxcairo.py file.) They keep adding
things to the middle of the structure instead of to the end, which
breaks backwards compatibility and we have to adjust the structure
information in our module. However I thought that we had worked out
what it needed to be be for 1.10.0, if you could experiment with changes
to _fields to make it work with cairo 1.10.0 (and a PyCairo built for
1.10.0) and send a patch it would be appreciated.