installers.rst 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. Installer details
  2. =================
  3. The installers pynsist builds do a number of things:
  4. 1. Install a number of files in the installation directory the user selects:
  5. - An embedded build of Python, including the standard library.
  6. - A copy of the necessary Microsoft C runtime for Python to run, if this
  7. is not already installed on the system.
  8. - The launcher script(s) that start your application
  9. - The icon(s) for your application launchers
  10. - Python packages your application needs
  11. - Any other files you specified
  12. 2. Create a start menu shortcut for each launcher script. If there is only one
  13. launcher, it will go in the top level of the start menu. If there's more than
  14. one, the installer will make a folder named after the application.
  15. 3. If you have specified any :ref:`commands <command_config>`, modify the
  16. :envvar:`PATH` environment variable in the registry, so that your commands
  17. will be available in a system command prompt.
  18. 4. Byte-compile all Python files in the ``pkgs`` subdirectory. This should
  19. slightly improve the startup time of your application.
  20. 5. Write an uninstaller, and the registry keys to put it in 'Add/remove programs'.
  21. The installer (and uninstaller) is produced using `NSIS
  22. <http://nsis.sourceforge.net/Main_Page>`_, with the Modern UI.
  23. .. _log-file:
  24. Logging output
  25. --------------
  26. When your installed application is run in GUI mode (without a console), any
  27. output from ``print()`` (and anything else that writes to stdout or stderr
  28. from Python) will be written to a file :file:`%APPDATA%\\\\{scriptname}.log`.
  29. On Windows 7, :envvar:`APPDATA` defaults to
  30. :file:`C:\\Users\\{username}\\AppData\\Roaming`.
  31. This file is recreated each time your application is launched, so it shouldn't
  32. keep growing larger.
  33. You can override this by setting :data:`sys.stdout` and :data:`sys.stderr`.
  34. Uncaught exceptions
  35. -------------------
  36. If there is an uncaught exception in your application - for instance if it fails
  37. to start because a package is missing - the traceback will be written to the
  38. same log file described in :ref:`log-file`. If users report crashes, details
  39. of the problem will probably be found there.
  40. You can override this by setting :func:`sys.excepthook`.
  41. This is only provided if you specify your application using ``entry_point``.
  42. You can also debug an installed application by using the installed Python to
  43. launch the application. This will show tracebacks in the Command Prompt.
  44. In the installation directory run::
  45. C:\\Program Files\\Application>Python\\python.exe "Application.launch.pyw"
  46. Working directory
  47. -----------------
  48. If users start your application from the start menu shortcuts, the working
  49. directory will be set to their home directory (``%HOMEDRIVE%%HOMEPATH%``). If
  50. they double-click on the scripts in the installation directory, the working
  51. directory will be the installation directory. Your application shouldn't
  52. rely on having a particular working directory; if it does, use :func:`os.chdir`
  53. to set it first.