py2exe, Inno Setup, and tkinter

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Anthony Baxter

    py2exe, Inno Setup, and tkinter

    I'm trying to use py2exe and Inno Setup to build an installer for
    shtoom, which uses tkinter.

    If I take the py2exe generated directory, and run the executable from
    there, it works fine.

    If I add all the files in the directory to an installer (including
    the tk-8.4 and tcl-8.4 directories), it builds an installer fine.

    But when I run the installer, and install to, say c:/Program Files/Shtoom,
    running the program fails with
    Traceback (most recent call last):
    File "<string>", line 78, in ?
    File "<string>", line 75, in main
    File "<string>", line 66, in findUserInterfa ce
    File "<string>", line 33, in tryTkInterface
    File "shtoom\ui\tksh toom.pyc", line 23, in main
    File "shtoom\ui\tkui \main.pyc", line 11, in __init__
    File "Tkinter.py c", line 1564, in __init__
    _tkinter.TclErr or: Can't find a usable init.tcl in the following directories:
    {c:/Program Files/lib/tcl8.4} {c:/Program Files/lib/tcl8.4} c:/lib/tcl8.4 {c:/Program Files/library} c:/library c:/../tcl8.4.3/library

    This probably means that Tcl wasn't installed properly.

    The init.tcl is actually in C:/Program Files/Shtoom/tcl8.4. Why is
    it not looking in the correct location? How can I fix this?

    Thanks,
    Anthony

  • Brian Kelley

    #2
    Re: py2exe, Inno Setup, and tkinter

    Anthony Baxter wrote:[color=blue]
    > I'm trying to use py2exe and Inno Setup to build an installer for
    > shtoom, which uses tkinter.
    >
    > If I take the py2exe generated directory, and run the executable from
    > there, it works fine.
    >
    > If I add all the files in the directory to an installer (including
    > the tk-8.4 and tcl-8.4 directories), it builds an installer fine.[/color]

    I have a script for creating innosetup's [FILE] section. I have used
    this just fine so it fails for you it may indicate a problem with tcl/tk
    on your *normal* installation. Can you run your program outside of py2exe?

    Here is the script:

    import os
    # This script creates the [FILES] section for innosetup
    # I use it for creating the installer for py2exe
    # generated distributions. Mainly because adding the
    # tcl/tk stuff is a royal pain.

    # Point FROM_DIRECTORY to py2exe's destination directory
    # This will include all tcl/tk and wxPython files and
    # everything else in the directory and subdirectories.

    FROM_DIRECTORY = r"C:\Users\kell ey\Working\Plat eReader\app\dis t\Vista"

    os.chdir(FROM_D IRECTORY)
    def innoSourceLine( source, dest):
    return 'Source: "%s"; DestDir: "{app}\%s"; CopyMode:
    alwaysoverwrite '%(source, dest)

    for root, dirs, files in os.walk("."):
    sourcedir = os.path.abspath (root)
    for f in files:
    # get the destination directory
    source = os.path.join(so urcedir, f)
    dest = root
    print innoSourceLine( source, dest)


    # Brian

    Comment

    • Thomas Heller

      #3
      Re: py2exe, Inno Setup, and tkinter

      Anthony Baxter <anthony@interl ink.com.au> writes:
      [color=blue]
      > I'm trying to use py2exe and Inno Setup to build an installer for
      > shtoom, which uses tkinter.
      >
      > If I take the py2exe generated directory, and run the executable from
      > there, it works fine.
      >
      > If I add all the files in the directory to an installer (including
      > the tk-8.4 and tcl-8.4 directories), it builds an installer fine.
      >
      > But when I run the installer, and install to, say c:/Program Files/Shtoom,
      > running the program fails with
      > Traceback (most recent call last):
      > File "<string>", line 78, in ?
      > File "<string>", line 75, in main
      > File "<string>", line 66, in findUserInterfa ce
      > File "<string>", line 33, in tryTkInterface
      > File "shtoom\ui\tksh toom.pyc", line 23, in main
      > File "shtoom\ui\tkui \main.pyc", line 11, in __init__
      > File "Tkinter.py c", line 1564, in __init__
      > _tkinter.TclErr or: Can't find a usable init.tcl in the following directories:
      > {c:/Program Files/lib/tcl8.4} {c:/Program Files/lib/tcl8.4} c:/lib/tcl8.4 {c:/Program Files/library} c:/library c:/../tcl8.4.3/library
      >
      > This probably means that Tcl wasn't installed properly.
      >
      > The init.tcl is actually in C:/Program Files/Shtoom/tcl8.4. Why is
      > it not looking in the correct location? How can I fix this?[/color]

      Are you sure your installer reproduces the same directory structure as
      the dist directory has?

      I would expect the init.tcl in this directory:

      c:/Program Files/shtoom/tcl/tcl8.4/init.tcl

      Thomas

      Comment

      Working...