From: Fahlgren, E. <efa...@li...> - 2012-02-07 23:11:31
|
Fabio, Here's how I handle what Mark is suggesting, by writing to cwd (assuming we're in the "start-in" directory). This is all hacked into boot_common.py in the installation. class Stderr(object): softspace = 0 _file = None _fname = os.path.join(os.getcwd(), 'error.log') _error = None _editor = os.path.expandvars("$WINDIR\\explorer.exe") def _showLog(self): from os import system if self._file: self._file.close() self._file = None system('start "" /B "%s" "%s"' % (self._editor, self._fname)) def write(self, text, alert=sys._MessageBox, fname=_fname): if self._file is None and self._error is None: self._fname = fname try: self._file = open(fname, 'w') except Exception as details: self._error = details import atexit atexit.register(alert, 0, "The logfile '%s' could not be opened:\n %s" % \ (fname, details), "Errors occurred") else: import atexit if os.path.exists(self._editor): atexit.register(self._showLog) else: atexit.register(alert, 0, "See the logfile '%s' for details" % fname, "Errors occurred") import my application's standard error output module as APP self._file.write( (("="*80)+"\n" + "Please e-mail this file to su...@bl... with any information\n" "that might help reproduce the problem.\n" "\n" "Error Log - %s\n" " Product: %s\n" " Version: %s\n" " User : %s\n" " Host : %s\n" " Editor : %s\n" " Argv : %s\n" + ("="*80)+"\n") % (APP.getTime(), APP.getProductName(), APP.getProductVersion(), APP.getUserName(), APP.getHostName(), self._editor, ' '.join(sys.argv[1:])) ) if self._file is not None: self._file.write(text) self._file.flush() def flush(self): if self._file is not None: self._file.flush() sys.stderr = Stderr() Eric > -----Original Message----- > From: Mark Hammond [mailto:ski...@gm...] > Sent: Tuesday, February 07, 2012 2:46 PM > To: Fabio Spadaro > Cc: py2...@li... > Subject: Re: [Py2exe-users] Not write sqliteroot.exe.log in c:\program > (x86) permission denied > > That file is written by py2exe itself when it finds stuff written to > sys.stderr. py2exe should probably be updated to do something more sane, > but in the meantime you should probably arrange to set sys.stderr to an > object that does something more sane, like write to the temp directory. > See boot_common.py in the py2exe distro for more details on how py2exe > does that... > > Hope this helps, > > Mark > > On 7/02/2012 11:41 PM, Fabio Spadaro wrote: > > > > Hi all. My application (downloaded at www.sqliteroot.com > > <http://www.sqliteroot.com>) is compiled with py2exe and redistributed > > with inno setup. > > Some users have said that after the application is installed on c: > > \program(x86)\sqliteroot launch the executable and show the message > > "not write in c: \program (x86)\sqlite Root\sqliteroot.exe.log > > permission denied ". I know it's a problem related to the write > > permissions on c:\program (x86). > > But I know who writes the file sqliteroot.exe.log and why I get this > > error since I set in the manifest: > > <requestedPrivileges> > > <requestedExecutionLevel level="asInvoker" uiAccess="false"/> > > </requestedPrivileges> > > > > Around the problem I set in the DefaultDirName of .iss userprograms {} > > instead of {pf} > > > > Follow setup.py: > > from distutils.core import setup > > import py2exe > > import os > > import re > > import shutil > > from glob import glob > > import py_compile > > > > VERSION = "1.9.7.4" > > > > src = ['core.pyc'] > > > > dd = ("lib", #Microsoft.VC90.CRT", > > glob(r'man/*.*')) > > > > # + man > > # | > > # |---- m.manifest > > # |---- msvcm90.dll > > # |---- msvcp90.dll > > # |---- msvcr90.dll > > # > > src.append(dd) > > > > setup( > > options = {"py2exe": {"compressed": 1,"optimize": 2}}, > > version = VERSION, > > description = "Sqlite Root application", > > name = "sqlwxpy Root application", > > zipfile = "lib/shardlib", > > windows = [{"script": > > "SqliteRoot.py","icon_resources":[(0x0001,"logo.ico")] }] , > > data_files = src > > ) > > > > > > Follow m.manifest in man: > > > > <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly > > xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> > > <noInheritable></noInheritable> <assemblyIdentity type="win32" > > name="m.manifest" version="9.0.30729.1" > > processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"> > > </assemblyIdentity> > > > > <dependency> > > <dependentAssembly> > > <assemblyIdentity > > type="win32" > > name="Microsoft.Windows.Common-Controls" > > version="6.0.0.0" > > publicKeyToken="6595b64144ccf1df" > > language="*" > > processorArchitecture="x86"/> </dependentAssembly> > > </dependency> > > > > <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> > > <security> > > <requestedPrivileges> > > <requestedExecutionLevel > > level="asInvoker" > > uiAccess="false"/> > > </requestedPrivileges> > > </security> > > </trustInfo> > > > > > > > > > > <file name="msvcr90.dll" hashalg="SHA1" > > hash="9785b1c493deb5b2134dc4aef3719cee207001bc"> > > <asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" > > xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"> > > <dsig:Transforms><dsig:Transform > > Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:T > > ransform></dsig:Transforms> > > <dsig:DigestMethod > > Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod > > > <dsig:DigestValue>VF5ECUAHPV7EnUf+/UIXMPizPvs=</dsig:DigestValue> > > </asmv2:hash> > > </file> > > <file name="msvcp90.dll" hashalg="SHA1" > > hash="0f6bbf7fe4fb3fca2cb5b542eca1a1cad051f01c"> > > <asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" > > xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"> > > <dsig:Transforms><dsig:Transform > > Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:T > > ransform></dsig:Transforms> > > <dsig:DigestMethod > > Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod > > > <dsig:DigestValue>3Wg+StVMq2uhx7POnAkl2w4dDmY=</dsig:DigestValue> > > </asmv2:hash> > > </file> > > <file name="msvcm90.dll" hashalg="SHA1" > > hash="7f3290ab2b7444c2b4a9b1fedfdb16466d7a21bb"> > > <asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" > > xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"> > > <dsig:Transforms><dsig:Transform > > Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:T > > ransform></dsig:Transforms> > > <dsig:DigestMethod > > Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod > > > <dsig:DigestValue>/YfRn7UQENzdMeoMHxTgdRMiObA=</dsig:DigestValue> > > </asmv2:hash> > > </file> > > </assembly> > > > > > > -- > > Fabio Spadaro > > > > Try Sqlite Root a GUI Admin Tools for manage Sqlite Database: > > www.sqliteroot.com <http://www.sqliteroot.com> > > > > > > > > ---------------------------------------------------------------------- > > -------- Keep Your Developer Skills Current with LearnDevNow! > > The most comprehensive online learning library for Microsoft > > developers is just $99.99! Visual Studio, SharePoint, SQL - plus > > HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you > subscribe now! > > http://p.sf.net/sfu/learndevnow-d2d > > > > > > > > _______________________________________________ > > Py2exe-users mailing list > > Py2...@li... > > https://lists.sourceforge.net/lists/listinfo/py2exe-users > > > -------------------------------------------------------------------------- > ---- > Keep Your Developer Skills Current with LearnDevNow! > The most comprehensive online learning library for Microsoft developers is > just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, > Metro Style Apps, more. Free future releases when you subscribe now! > http://p.sf.net/sfu/learndevnow-d2d > _______________________________________________ > Py2exe-users mailing list > Py2...@li... > https://lists.sourceforge.net/lists/listinfo/py2exe-users |