user2168621
user2168621

Reputation:

Py2app problems

I have created a python script that uses a tkinter GUI, I have tried to package it using py2app, My problem is that i dont know how to include the tkinter module. I have tried packaging my script without the module but all i get is a console message saying "ImportError: no module named tkinter"

Upvotes: 2

Views: 5193

Answers (3)

Ajax1234
Ajax1234

Reputation: 71451

one way to package the app is running this command:

    py2applet --make-setup filename.py

Then, you can run:

    python3 setup.py py2app -A

Upvotes: 0

tsgsteele
tsgsteele

Reputation: 97

To bundle the app I'm assuming you put this in the terminal:

$ python setup.py py2app

I also had the same problem and have been ransacking the internet searching for a solution. I am also running python 3.3 on a mac. After I put this:

$ python3 setup.py py2app

it worked like a charm! Hope this helps!

Upvotes: 4

Ronald Oussoren
Ronald Oussoren

Reputation: 2810

The following setup.py script should do the trick for a basic Tkinter based script (replace 'hello.py' by the name of the actual script).

from setuptools import setup

setup(
    app=['hello.py'],
    setup_requires=["py2app"],
)

This is the setup.py script from py2app's hello_tk example

UPDATE:

You mention later on that tkinter cannot be imported from "outside" the py2app'd application either, and that the _tkinter extension (_tkinter.so) doesn't exist. That means that something is wrong with your installation of Python 3.3.

Upvotes: 2

Related Questions