Below are the changes I made in the .py files before applying 2to3 tool to convert the PyInstaller code to support Python 3 File Name: PyInstaller/archive.py: 219: #self.lib.write('\0'*self.HDRLEN)# - - - self.lib.write(b'\0'*self.HDRLEN)# + + +
292: #MAGIC = 'PYZ\0'# - - - MAGIC = b'PYZ\0'# + + + File Name: PyInstaller/bindepend.py: 114: #npth = os.path.join(p, string.lower(mod))# - - - npth = os.path.join(p, mod.lower())# + + + 132: #tokens = string.split(txt[i])# - - - #if len(tokens) == 1 and string.find(tokens[0], '.') > 0:# - - - #rslt.append(string.strip(tokens[0]))# - - - tokens = txt[i].split()# + + + if len(tokens) == 1 and tokens[0].find('.') > 0:# + + + rslt.append(tokens[0].strip())# + + + 265: #nm, jnk = string.split(nm, '\0', 1)# - - - nm, sep, jnk = nm.partition(b'\0')# + + + nm = str(nm) # + + + jnk, sep, nm = nm.partition('\'') # + + + nm = nm.rstrip('\'') # + + + 278: #fullnm = string.upper(os.path.basename(pth))# - - - #if seen.get(string.upper(nm),0): fullnm = os.path.basename(pth).upper()# + + + if seen.get(nm.upper(),0): # + + + 282: #seen[string.upper(nm)] = 1# - - - seen[nm.upper()] = 1# + + + 284: #if seen.get(string.upper(lib),0):# - - - if seen.get(lib.upper(),0):# + + + 401: #_bpath.extend(string.split(os.environ.get('PATH', ''), os.pathsep))# - - - _bpath.extend(os.environ.get('PATH', '').split(os.pathsep))# + + + 418: #for path in string.split(lp, os.pathsep):# - - - for path in lp.split(os.pathsep):# + + + File Name: PyInstaller/Build.py 33: #import UserList# - - - import collections# + + + 856: #class TOC(UserList.UserList):# - - - class TOC(collections.UserList):# + + + 858: #UserList.UserList.__init__(self)# - - - collections.UserList.__init__(self)# + + + File Name: PyInstaller/carchive.py: 91: #return string.join(rslt, '')# - - - return b''.join(rslt)# + + + 124: #MAGIC = 'MEI\014\013\012\013\016'# - - - MAGIC = b'MEI\014\013\012\013\016'# + + + File Name: PyInstaller/Configure.py 97: #a.analyze_r('Tkinter')# - - - a.analyze_r('tkinter')# + + + File Name: PyInstaller/icon.py: 28: #StringTypes = types.StringTypes# - - - StringTypes = str# + + + File Name: PyInstaller/iu.py: 48: #STRINGTYPE = basestring# - - - STRINGTYPE = str# - - - 403: if importernm.find('xml.sax') == -1:# + + + importernm = _string_split(importernm, '.')[:-level] importernm = _string_join('.', importernm) File Name: PyInstaller/Makespec.py: 27: #True = 1 == 1 # - - - #False = not True # - - - pass # + + + File Name: PyInstaller/mf.py: 21: #import sys, string, os, imp, marshal, dircache, glob# - - - import sys, string, os, imp, marshal, glob# + + + 38: #STRINGTYPE = basestring# - - - STRINGTYPE = str# + + + 44: #files = dircache.listdir(os.path.dirname(filename))# - - - files = os.listdir(os.path.dirname(filename))# + + + 116: #stuff = self._read(py[0])+'\n'# - - - #co = compile(string.replace(stuff, "\r\n", "\n"), py[0], 'exec')# - - - stuff = (self._read(py[0])).decode()+'\n' # + + + co = compile(stuff.replace("\r\n", "\n"), py[0], 'exec')# + + + 394: #import UserDict# - - - #class LogDict(UserDict.UserDict):# - - - import collections# + + + class LogDict(collections.UserDict):# + + + 398: #UserDict.UserDict.__init__(self, *args)# - - - collections.UserDict.__init__(self, *args)# + + + 404: #UserDict.UserDict.__setitem__(self, key, value)# - - - collections.UserDict.__setitem__(self, key, value)# + + + 407: #UserDict.UserDict.__delitem__(self, key)# - - - collections.UserDict.__delitem__(self, key)# + + + 441: #nms = map(None, nms, [importer]*len(nms))# - - - names = list(nms)# + + + nms = []# + + + for name1 in names: # + + + nms.append((name1,importer))# + + + 460: #newnms = map(None, newnms, [nm]*len(newnms))# - - - names = list(newnms)# + + + newnms = [] for name2 in names: newnms.append((name2,nm))# + + + 473: #nmparts = string.split(nm, '.')# - - - nmparts = nm.split('.')# + + + 483: #pkgnm = string.join(string.split(importernm, '.')[:-1], '.')# - - - pkgnm = '.'.join(importernm.split('.')[:-1])# + + + 492: #contexts = [string.join(string.split(importernm, '.')[:-level], '.')]# - - - if importernm.find('xml.sax') == -1:# + + + for handling import xml.sax contexts = ['.'.join(importernm.split('.')[:-level])] else:# + + + contexts = ['.'.join(importernm.split('.'))]# + + + 553: #co = compile(string.replace(stuff, "\r\n", "\n"), fnm, 'exec')# - - - co = compile(stuff.replace("\r\n", "\n"), fnm, 'exec')# + + + 858: #EXEC_STMT = dis.opname.index('EXEC_STMT')# - - - 893: #op = ord(c)# - - - op = c# + + + 895: #oparg = ord(code[i]) + ord(code[i+1])*256# - - - oparg = code[i] + code[i+1]*256# + + + 972: #elif op == EXEC_STMT: # - - - # cndtl = ['', 'conditional'][conditional] # - - - # lvl = ['top-level', 'delayed'][nested] # - - - # w.append("W: %s %s exec statement detected at line %s" % (lvl, cndtl, curline)) # - - - File Name: PyInstaller/hooks/hook-iu.py: 33: #pos = string.find(nm, '.')# - - - pos = nm.find('.')# + + + File Name: PyInstaller/hooks/hook-os.py 38: #pos = string.find(nm, '.')# - - - pos = nm.find('.')# + + + File Name: PyInstaller/hooks/hook-xml.py 27: #txt = exec_statement("import xml;print xml.__file__")# - - - txt = exec_statement("import xml;print (xml.__file__)")# + + + 29: #if string.find(txt, '_xmlplus') > -1:# - - - if txt.find('_xmlplus') > -1:# + + + File Name: PyInstaller/pyi_optik/option.py 22: #(True, False) = (1, 0)# - - - pass# + + + 83: #choices = string.join(map(repr, option.choices), ", ")# - - - choices = ", ".join(list(map(repr, option.choices)))# + + + 327: #self.dest = string.replace(self._long_opts[0][2:], '-', '_')# - - - self.dest = self._long_opts[0][2:].replace('-', '_')# + + + File Name: PyInstaller/pyi_optik/option_parser.py: 30: #(True, False) = (1, 0)# - - - SyntaxError: assignment to keyword pass # + + + 725: #return string.replace(s, "%prog", self.get_prog_name())# - - - return s.replace("%prog", self.get_prog_name())# + + + File Name: PyInstaller/pyi_optik/textwrap.py: 19: #(True, False) = (1, 0)# - - - SyntaxError: assignment to keyword pass # + + + 75: # whitespace_trans = string.maketrans(_whitespace, ' ' * len (_whitespace))# - - - whitespace_trans = string.maketrans(_whitespace.encode(), (' ' * len(_whitespace)).encode())# + + + 103: sentence_end_re = re.compile(r'[%s]' # lowercase letter r'[\.\!\?]' # sentence- ending punct. r'[\"\']?' # optional end- of-quote % string.ascii_letters)# + + + #% string.lowercase)# - - - AttributeError: 'module' object has no File Name: PyInstaller/source/linux/make.py: 45: #True, False = 1, 0# - - - pass# + + + 130: freeze_exceptions = 0# + + + files = ['main.c', '../common/launch.c'] # + + + have_warnings = 1# + + + #Commented the lines below because there is no module called exceptions in python 3 """have_warnings = 0 import exceptions if not hasattr(exceptions, '__file__'): freeze_exceptions = 0 files = ['main.c', '../common/launch.c'] if hasattr(exceptions, 'Warning'): have_warnings = 1 else: freeze_exceptions = 1 import exceptions print "reading exceptions from", exceptions.__file__ inf = open(exceptions.__file__, 'rb') inf.seek(8) code = inf.read() codelen = len(code) outfp = bkfile.open('M_exceptions.c', 'w') files = ['M_exceptions.c', 'main.c', '../common/launch.c'] outfp.write('unsigned char M_exceptions[] = {') for i in range(0, len(code), 16): outfp.write('\n\t') for c in code[i:i+16]: outfp.write('%d,' % ord(c)) outfp.write('\n};\n') outfp.close() """ 178: #somevars['CFLAGS'] = string.join(cflags) # override# - - - somevars['CFLAGS'] = ' '.join(cflags) # override# + + + 189: #makemakefile.writevars(outfp, somevars, string.join(targets))# - - - makemakefile.writevars(outfp, somevars, ' '.join(targets))# + + + 197: #print 'Now run "make" to build the targets:', string.join (targets)# - - - print('Now run "make" to build the targets:', ' '.join(targets))# + + + File Name: PyInstaller/source/linux/makemakefile: 44: #outfp.write("\n%s: %s\n" % (target, string.join(deps)))# - - - #outfp.write("\t$(CC) %s -o %s $(LDLAST)\n" %(string.join(files), target)) outfp.write("\n%s: %s\n" % (target, ' '.join(deps)))# + + + outfp.write("\t$(CC) %s -o %s $(LDLAST)\n" %(' '.join(files), target)) After applying the 2to3 conversion tool I needed to change two lines in the file PyInstaller/py_optic/option_parser.py. Thes changes are as below: 210, 496: if type(args[0]) is types.StringType: #before applying 2to3 tool if type(args[0]) is bytes: #after applying 2to3 tool if type(args[0]) is str: # I needed to change to Below are the changes I made in the bootloader program to support to make it work with Python 3. After making these changes I used Scon and Python 2.6 to build the bootloader. File Name: PyInstaller/source/common/launch.c 69: //DECLPROC(PyString_FromStringAndSize);// - - - //DECLPROC(PyFile_FromString); // - - - //DECLPROC(PyString_AsString); // - - - DECLPROC(PyBytes_FromStringAndSize);// + + + DECLPROC(PyBytes_AsString);// + + + 87: //DECLPROC(PyInt_AsLong);// - - - DECLPROC(PyLong_AsLong);// + + + 394: //GETPROC(dll, PyString_FromStringAndSize);// - - - GETPROC(dll, PyBytes_FromStringAndSize);// + + + 403: //GETPROC(dll, PyFile_FromString);// - - - //GETPROC(dll, PyString_AsString); // - - - GETPROC(dll, PyBytes_AsString); // + + + 422: //GETPROC(dll, PyInt_AsLong);// - - - GETPROC(dll, PyLong_AsLong);// + + + 730: //co = PI_PyObject_CallFunction(loadfunc, "s#", modbuf+8, ntohl (ptoc->ulen)-8);// - - - co = PI_PyObject_CallFunction(loadfunc, "y#", modbuf+8, ntohl(ptoc- >ulen)-8);// + + + 871: //block_size = PI_PyInt_AsLong(PI_PyDict_GetItemString(aes_dict, "block_size"));// - - - block_size = PI_PyLong_AsLong(PI_PyDict_GetItemString(aes_dict, "block_size"));// + + + 881: //memcpy(data, PI_PyString_AsString(ddata), ntohl(ptoc- >len)-32);// - - - memcpy(data, PI_PyBytes_AsString(ddata), ntohl(ptoc->len)-32);// + + + 1038: //__file__ = PI_PyString_FromStringAndSize(buf, strlen(buf));// - - - __file__ = PI_PyBytes_FromStringAndSize(buf, strlen(buf));// + + + 1089: //*presult = PI_PyInt_AsLong(pyresult);// - - - *presult = PI_PyLong_AsLong(pyresult);// + + + File Name: PyInstaller/source/common/launch.h 120: //EXTDECLPROC(PyObject *, PyString_FromStringAndSize, (const char *, int));// - - - //EXTDECLPROC(PyObject *, PyFile_FromString, (char *, char *));// - - - //EXTDECLPROC(char *, PyString_AsString, (PyObject *));// - - - EXTDECLPROC(PyObject *, PyBytes_FromStringAndSize, (const char *, int));// + + + EXTDECLPROC(char *, PyBytes_AsString, (PyObject *));// + + + 138: //EXTDECLPROC(long, PyInt_AsLong, (PyObject *) );// - - - EXTDECLPROC(long, PyLong_AsLong, (PyObject *) );// + + + File Name: PyInstaller/sconstruct 20: import os 33: #base_env = Environment(MSVS_VERSION = msvs_ver)# - - - base_env = Environment(ENV = {'PATH' : os.environ['PATH']}) # + + + For making all of these changes I took help from Python 3 manual, the site http://diveintopython3.org/table-of-contents.html and other information from net. This is working fine with Linux, but on Windows I am getting “The exception unknown software exception (0xc0000417) occurred in the application at location 0x78588389”. Please guide me to resolve this issue. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "PyInstaller" group. To post to this group, send email to PyInstaller@googlegroups.com To unsubscribe from this group, send email to pyinstaller+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/PyInstaller?hl=en -~----------~----~----~----~------~----~------~--~---