py2exe, Inno Setup, and tkinter

A

Anthony Baxter

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 findUserInterface
File "<string>", line 33, in tryTkInterface
File "shtoom\ui\tkshtoom.pyc", line 23, in main
File "shtoom\ui\tkui\main.pyc", line 11, in __init__
File "Tkinter.pyc", line 1564, in __init__
_tkinter.TclError: 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
 
B

Brian Kelley

Anthony said:
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.

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\kelley\Working\PlateReader\app\dist\Vista"

os.chdir(FROM_DIRECTORY)
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(sourcedir, f)
dest = root
print innoSourceLine(source, dest)


# Brian
 
T

Thomas Heller

Anthony Baxter said:
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 findUserInterface
File "<string>", line 33, in tryTkInterface
File "shtoom\ui\tkshtoom.pyc", line 23, in main
File "shtoom\ui\tkui\main.pyc", line 11, in __init__
File "Tkinter.pyc", line 1564, in __init__
_tkinter.TclError: 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?

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
 
B

Brian Kelley

Thomas said:
Are you sure your installer reproduces the same directory structure as
the dist directory has?
The short script I sent reproduces the same directory structures with
innosetup.
I would expect the init.tcl in this directory:

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

Thomas

Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top