Python/Tkinter: Examples not working

Linux howto's, compile information, information on whatever we learned on working with linux, MACOs and - of course - Products of the big evil....
Post Reply
User avatar
^rooker
Site Admin
Posts: 1481
Joined: Fri Aug 29, 2003 8:39 pm

Python/Tkinter: Examples not working

Post by ^rooker »

[PROBLEM]
I was trying to go through the tutorial for Tkinter at Pythonware

The hello world example gave me the following, strange errormessage:
from: can't read /var/mail/Tkinter
./ex1.py: line 5: syntax error near unexpected token `('
./ex1.py: line 5: `root = Tk()'
[SOLUTION]
The reason for the error is that the examples don't start with the linux typical "shebang!" - e.g. "#!/usr/bin/python", but with "# file: xxx".

Change the first line to the correct shebang for your environment and everything's fine.

Examples:
"#!/usr/bin/python" for Debian based distros (e.g. Ubuntu)
"#!/usr/bin/env python" to be less path dependent
Jumping out of an airplane is not a basic instinct. Neither is breathing underwater. But put the two together and you're traveling through space!
Post Reply