My setup_exe.py is attached. It adds matplotlib. My setup_exe.conf is the standard one plus copy_scripts: No. I also strip some folders/files from web2py_win.zip, namely: applications/admin, applications/welcome (but include welcome.w2p), applications/examples, tcl8.5/tzdata, and tk8.5/demos. This way of building the win package has worked for me up until 2.6.4. Like I said it also works for 2.8.2 provided that I don't slim down library.zip - you can see from the attached file that I simply commented out that code block. I tested swapping in/out a fat and a lean library.zip, and each time the lean library.zip is used python can't import module http.
On Tuesday, February 4, 2014 4:02:14 PM UTC+1, Niphlod wrote: > > how are you "custom building" the binary ? > > The "official" scripts deals with py2exe's incorrect packaging system with > these lines > > > https://github.com/web2py/web2py/blob/master/extras/build_web2py/setup_exe.py#L100 > > BTW: we're moving towards bbfreeze packed binaries, and they seem to work > well with bbreeze 0.13 > > On Tuesday, February 4, 2014 12:50:54 PM UTC+1, step wrote: >> >> In upgrading from 2.6.4 to 2.8.2 my custom-built web2py_no_console.exe >> failed starting the rocket server with a 'can't import module http' python >> error. It's something seemingly unrelated to the other posters' issues, but >> I'm sharing how I was able to fix it, maybe it will help someone. >> Essentially the fix consists in editing web2py_exe.py and commenting out >> the new code block that slims down library.zip. That was it, in my case. I >> rebuilt my web2py_no_console.exe with the fatter library.zip and the import >> error went away. The new code was added in 2.8.2, apparently it's harmless >> but in my case it makes the difference between a working >> web2py_no_console.exe and a broken one. I wonder, maybe there is a reason >> why py2exe builds a larger library.zip file so seemingly full of >> duplicates. For the record, I wish the size trimming had worked - in my >> case it had shrunk library.zip from 16MB down to about 6MB. >> >> On Saturday, January 18, 2014 7:08:58 PM UTC+1, Niphlod wrote: >>> >>> we're trying to come up with something here >>> http://code.google.com/p/web2py/issues/detail?id=1809 >>> >>> if you have any inputs please share ^_^ >>> >>> On Saturday, January 18, 2014 1:30:33 AM UTC+1, Ray (a.k.a. Iceberg) >>> wrote: >>>> >>>> >>>> >>>> On Sunday, December 15, 2013 10:00:19 AM UTC-7, Rob Paire wrote: >>>>> >>>>> Hello all, >>>>> I am having same problem running on Windows server 2003 32bit. When I >>>>> launch web2py.exe the following dialog error appears: >>>>> >>>>> *Title: Error Entry Point Not Found* >>>>> >>>>> *Description: The procedure entry point wcscpy_s could not be located >>>>> in the dynamic link library msvcrt.dll* >>>>> >>>>> Clicking OK returns control to the web2py executable which fails with >>>>> the following console message: >>>>> >>>>> C:\web2py>web2py >>>>> Traceback (most recent call last): >>>>> File "<string>", line 6, in <module> >>>>> File "__main__.py", line 128, in <module> >>>>> File "__main__web2py__.py", line 18, in <module> >>>>> File "/home/mdipierro/make_web2py/web2py/gluon/__init__.py", line >>>>> 15, in <modu >>>>> le> >>>>> File "/home/mdipierro/make_web2py/web2py/gluon/globals.py", line 19, >>>>> in <modul >>>>> e> >>>>> File "/home/mdipierro/make_web2py/web2py/gluon/xmlrpc.py", line 10, >>>>> in <module >>>>> > >>>>> File "SimpleXMLRPCServer.py", line 102, in <module> >>>>> File "xmlrpclib.py", line 144, in <module> >>>>> File "httplib.py", line 79, in <module> >>>>> File "mimetools.py", line 6, in <module> >>>>> File "tempfile.py", line 35, in <module> >>>>> File "random.py", line 879, in <module> >>>>> File "random.py", line 97, in __init__ >>>>> File "random.py", line 111, in seed >>>>> WindowsError: [Error -2146893795] Provider DLL failed to initialize >>>>> correctly >>>>> >>>>> I reverted back to 2.7.4 for the time being. >>>>> >>>>> >>>> Same problem here. I guess that *msvcrt.dll* thing is because the >>>> web2py282 windows builder is running on a different Windows platform than >>>> before. >>>> Now I have to roll back. >>>> >>> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
#!/usr/bin/env python # -*- coding: utf-8 -*- #Adapted from http://bazaar.launchpad.net/~flavour/sahana-eden/trunk/view/head:/static/scripts/tools/standalone_exe.py USAGE = """ Usage: Copy this and setup_exe.conf to web2py root folder To build with py2exe: Install py2exe: http://sourceforge.net/projects/py2exe/files/ run python setup_exe.py py2exe To build with bbfreeze: Install bbfreeze: https://pypi.python.org/pypi/bbfreeze/ run python setup_exe.py bbfreeze """ from distutils.core import setup from gluon.import_all import base_modules, contributed_modules from gluon.fileutils import readlines_file from glob import glob import fnmatch import os import shutil import sys import re import zipfile import matplotlib if len(sys.argv) != 2 or not os.path.isfile('web2py.py'): print USAGE sys.exit(1) BUILD_MODE = sys.argv[1] if not BUILD_MODE in ('py2exe', 'bbfreeze'): print USAGE sys.exit(1) def unzip(source_filename, dest_dir): with zipfile.ZipFile(source_filename) as zf: zf.extractall(dest_dir) #borrowed from http://bytes.com/topic/python/answers/851018-how-zip-directory-python-using-zipfile def recursive_zip(zipf, directory, folder=""): for item in os.listdir(directory): if os.path.isfile(os.path.join(directory, item)): zipf.write(os.path.join(directory, item), folder + os.sep + item) elif os.path.isdir(os.path.join(directory, item)): recursive_zip( zipf, os.path.join(directory, item), folder + os.sep + item) #read web2py version from VERSION file web2py_version_line = readlines_file('VERSION')[0] #use regular expression to get just the version number v_re = re.compile('[0-9]+\.[0-9]+\.[0-9]+') web2py_version = v_re.search(web2py_version_line).group(0) #pull in preferences from config file import ConfigParser Config = ConfigParser.ConfigParser() Config.read('setup_exe.conf') remove_msft_dlls = Config.getboolean("Setup", "remove_microsoft_dlls") copy_apps = Config.getboolean("Setup", "copy_apps") copy_site_packages = Config.getboolean("Setup", "copy_site_packages") copy_scripts = Config.getboolean("Setup", "copy_scripts") make_zip = Config.getboolean("Setup", "make_zip") zip_filename = Config.get("Setup", "zip_filename") remove_build_files = Config.getboolean("Setup", "remove_build_files") include_gevent = Config.getboolean("Setup", "include_gevent") # Python base version python_version = sys.version_info[:3] if BUILD_MODE == 'py2exe': import py2exe mpl_datafiles = matplotlib.get_py2exe_datafiles() setup( console=[{'script':'web2py.py', 'icon_resources': [(0, 'extras/icons/g2.ico')] }], windows=[{'script':'web2py.py', 'icon_resources': [(1, 'extras/icons/g2.ico')], 'dest_base':'web2py_no_console' # MUST NOT be just 'web2py' otherwise it overrides the standard web2py.exe }], name="web2py", version=web2py_version, description="web2py web framework", author="Massimo DiPierro", license="LGPL v3", data_files=[ 'ABOUT', 'LICENSE', 'VERSION', ] + mpl_datafiles, options={'py2exe': { 'packages': contributed_modules + ['matplotlib'], 'includes': base_modules, 'excludes': ['_gtkagg', '_tkagg'], 'dll_excludes': [ 'libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll', 'libgdk_pixbuf-2.0-0.dll', 'libgtk-win32-2.0-0.dll', 'libglib-2.0-0.dll', 'libcairo-2.dll', 'libpango-1.0-0.dll', 'libpangowin32-1.0-0.dll', 'libpangocairo-1.0-0.dll', 'libglade-2.0-0.dll', 'libgmodule-2.0-0.dll', 'libgthread-2.0-0.dll', 'QtGui4.dll', 'QtCore.dll', 'QtCore4.dll' ], }}, ) if False: # SteP- the resulting library.zip can't import http module! #py2exe packages lots of duplicates in the library.zip, let's save some space library_temp_dir = os.path.join('dist', 'library_temp') library_zip_archive = os.path.join('dist', 'library.zip') os.makedirs(library_temp_dir) #shutil.copy(library_zip_archive,'P:/temp/keep.zip') # TODO del unzip(library_zip_archive, library_temp_dir) os.unlink(library_zip_archive) zipl = zipfile.ZipFile(library_zip_archive, "w", compression=zipfile.ZIP_DEFLATED) recursive_zip(zipl, library_temp_dir) zipl.close() shutil.rmtree(library_temp_dir) print "web2py binary successfully built" elif BUILD_MODE == 'bbfreeze': modules = base_modules + contributed_modules from bbfreeze import Freezer f = Freezer(distdir="dist", includes=(modules)) f.addScript("web2py.py") #to make executable without GUI we need this trick shutil.copy("web2py.py", "web2py_no_console.py") f.addScript("web2py_no_console.py", gui_only=True) if include_gevent: #fetch the gevented webserver script and copy to root gevented_webserver = os.path.join("handlers", "web2py_on_gevent.py") shutil.copy(gevented_webserver, "web2py_on_gevent.py") f.addScript("web2py_on_gevent.py") f.setIcon('extras/icons/web2py.ico') f() # starts the freezing process os.unlink("web2py_no_console.py") if include_gevent: os.unlink("web2py_on_gevent.py") #add data_files for req in ['ABOUT', 'LICENSE', 'VERSION']: shutil.copy(req, os.path.join('dist', req)) print "web2py binary successfully built" try: os.unlink('storage.sqlite') except: pass #This need to happen after bbfreeze is run because Freezer() deletes distdir before starting! if python_version > (2,5): # Python26 compatibility: http://www.py2exe.org/index.cgi/Tutorial#Step52 try: shutil.copytree('C:\Bin\Microsoft.VC90.CRT', 'dist/Microsoft.VC90.CRT/') except: print "You MUST copy Microsoft.VC90.CRT folder into the archive" def copy_folders(source, destination): """Copy files & folders from source to destination (within dist/)""" if os.path.exists(os.path.join('dist', destination)): shutil.rmtree(os.path.join('dist', destination)) shutil.copytree(os.path.join(source), os.path.join('dist', destination)) #should we remove Windows OS dlls user is unlikely to be able to distribute if remove_msft_dlls: print "Deleted Microsoft files not licensed for open source distribution" print "You are still responsible for making sure you have the rights to distribute any other included files!" #delete the API-MS-Win-Core DLLs for f in glob('dist/API-MS-Win-*.dll'): os.unlink(f) #then delete some other files belonging to Microsoft other_ms_files = ['KERNELBASE.dll', 'MPR.dll', 'MSWSOCK.dll', 'POWRPROF.dll'] for f in other_ms_files: try: os.unlink(os.path.join('dist', f)) except: print "unable to delete dist/" + f #Should we include applications? if copy_apps: copy_folders('applications', 'applications') print "Your application(s) have been added" else: #only copy web2py's default applications copy_folders('applications/admin', 'applications/admin') copy_folders('applications/welcome', 'applications/welcome') copy_folders('applications/examples', 'applications/examples') print "Only web2py's admin, examples & welcome applications have been added" copy_folders('extras', 'extras') copy_folders('examples', 'examples') copy_folders('handlers', 'handlers') #should we copy project's site-packages into dist/site-packages if copy_site_packages: #copy site-packages copy_folders('site-packages', 'site-packages') else: #no worries, web2py will create the (empty) folder first run print "Skipping site-packages" #should we copy project's scripts into dist/scripts if copy_scripts: #copy scripts copy_folders('scripts', 'scripts') else: #no worries, web2py will create the (empty) folder first run print "Skipping scripts" #should we create a zip file of the build? if make_zip: #create a web2py folder & copy dist's files into it shutil.copytree('dist', 'zip_temp/web2py') #create zip file zipf = zipfile.ZipFile(zip_filename + ".zip", "w", compression=zipfile.ZIP_DEFLATED) # just temp so the web2py directory is included in our zip file path = 'zip_temp' # leave the first folder as None, as path is root. recursive_zip(zipf, path) zipf.close() shutil.rmtree('zip_temp') print "Your Windows binary version of web2py can be found in " + \ zip_filename + ".zip" print "You may extract the archive anywhere and then run web2py/web2py.exe" #should py2exe build files be removed? if remove_build_files: if BUILD_MODE == 'py2exe': shutil.rmtree('build') shutil.rmtree('deposit') shutil.rmtree('dist') print "build files removed" #final info if not make_zip and not remove_build_files: print "Your Windows binary & associated files can also be found in /dist" print "Finished!" print "Enjoy web2py " + web2py_version_line