Thread: [PythonReports-users] PythonReports and py2exe
Brought to you by:
a1s
From: Werner F. B. <wer...@fr...> - 2013-01-03 18:58:40
|
Hi, I am at the stage where I like to test my distribution method with PythonReports. I use py2exe and InnoSetup to generate an installer. Updated my setup.py to ensure that PythonReports and reportlab get included by py2exe by adding them to "packages" option. However the way images are handled in PythonReports I run into this error: 19:39:52: can't open file 'C:\Program Files\TheWineCellarBookV4\lib\library.zip\PythonReports\editor\res\pythonreports.ico' (error 3: le chemin d'accès spécifié est introuvable.) 19:39:52: No handler found for image type. The French text means "access path is not found", however if I check the library.zip file it does contain the image, but I think "AddIconFromFile" can't deal with this path (and/or extracting from a zip archive). To get the images into the library.zip I had to do a hack in the setup.py to manually update the library.zip. The nicest way, in my view, would be to have the images in a resource file created by imp2py (wxPython tools). That approach should then be fine regards less of py2exe options/configuration (and should also work for other freezing tools, cxfrezze etc). I would be happy to do a patch for that change if this would be o.k. with you. Best regards Werner |
From: alexander s. <al...@go...> - 2013-01-04 08:47:29
|
On 03.01.2013 20:59, Werner F. Bruhin wrote: > > I use py2exe and InnoSetup to generate an installer. > > Updated my setup.py to ensure that PythonReports and reportlab get > included by py2exe by adding them to "packages" option. PythonReports should be found without explicit include. For my other project (no wx part, only reportlab-based builder and pdf output), I use "includes": [ "PythonReports.PILDrivers", "PythonReports.RLDrivers", ], "excludes": [ "tcl", "Tkinter", "_tkinter", ], > However the way images are handled in PythonReports I run into this error: > > 19:39:52: can't open file 'C:\Program Files\TheWineCellarBookV4\lib\library.zip\PythonReports\editor\res\pythonreports.ico' (error 3: le chemin d'accès spécifié est introuvable.) > 19:39:52: No handler found for image type. > > The French text means "access path is not found", however if I check the > library.zip file it does contain the image, but I think > "AddIconFromFile" can't deal with this path (and/or extracting from a > zip archive). No, it can't. The resources are to be packaged as data files, separate from library.zip. I have planned to add a check for ".zip" in module path to editor.utils.get_resource_dir(). In your case, the path would be 'C:\Program Files\TheWineCellarBookV4\lib\res\pythonreports.ico' - with directories up to and including library.zip removed by get_resource_dir(). > To get the images into the library.zip I had to do a hack in the > setup.py to manually update the library.zip. > > The nicest way, in my view, would be to have the images in a resource > file created by imp2py (wxPython tools). That approach should then be > fine regards less of py2exe options/configuration (and should also work > for other freezing tools, cxfrezze etc). I think that img2py will do, too. Best wishes, alex. |
From: alexander s. <al...@go...> - 2013-01-05 08:34:16
|
On 04.01.2013 12:56, Werner F. Bruhin wrote: > >> PythonReports should be found without explicit include. For my other >> project (no wx part, only reportlab-based builder and pdf output), I use >> >> "includes": [ >> "PythonReports.PILDrivers", >> "PythonReports.RLDrivers", > Instead of this I added it to 'packages' which forces the full the > package to be included: > packages = ['twcbsrc', 'email', 'amara', 'kinterbasdb', 'setuptools', > 'sqlalchemy', 'wx.lib.pubsub', 'PythonReports', 'reportlab'] This pulls in Tkinter which is quite weighty and absolutely unneeded in your case: you cannot use wx and Tk simultaneously. >> I think that img2py will do, too. > Attached a patch for using img2py This is checked in. > FYI, get_resources_dir is also used in "test_system.py" but with an non > existent image - is that to force a fail in the test? No, it was lost when I rearranged subpackages. Best wishes, alex. |
From: Werner F. B. <wer...@fr...> - 2013-01-05 09:39:02
|
On 05/01/2013 09:33, alexander smishlajev wrote: > On 04.01.2013 12:56, Werner F. Bruhin wrote: >>> PythonReports should be found without explicit include. For my other >>> project (no wx part, only reportlab-based builder and pdf output), I use >>> >>> "includes": [ >>> "PythonReports.PILDrivers", >>> "PythonReports.RLDrivers", >> Instead of this I added it to 'packages' which forces the full the >> package to be included: >> packages = ['twcbsrc', 'email', 'amara', 'kinterbasdb', 'setuptools', >> 'sqlalchemy', 'wx.lib.pubsub', 'PythonReports', 'reportlab'] > This pulls in Tkinter which is quite weighty and absolutely unneeded in > your case: you cannot use wx and Tk simultaneously. You are right, didn't show my exclude which I should for other users. excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses', 'pywin.debugger', 'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl', 'Tkconstants', 'Tkinter', "_tkinter", 'pydoc', 'doctest', 'test', 'sqlite3' dll_excludes = ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll', 'tcl84.dll', 'tk84.dll', 'fbclient.dll', 'icudt30.dll', 'icuin30.dll', 'icuuc30.dll', 'mswsock.dll', 'powrprof.dll', 'MSVCP90.dll'] Above is obviously adapted to the needs of my application and each user should adapt it to his/her needs. > >>> I think that img2py will do, too. >> Attached a patch for using img2py > This is checked in. Great, thanks for accepting this patch. Werner |