Error using tkinter

Fredrik Lundh fredrik at pythonware.com
Tue Apr 18 05:24:31 EDT 2006


"JyotiC" wrote:

> I am getting the error
>
>        Exception in Tkinter callback
> Traceback (most recent call last):
>  File "/usr/lib/python2.3/lib-tk/Tkinter.py", line 1345, in __call__
>    return self.func(*args)
>  File "gui.py", line 248, in writescript
>    f = open('crossManual.sh','w')
> TypeError: an integer is required
>
> Couldn't understand what it means

let me guess: gui.py contains the line "from os import *" ?

this means that "open" refers to os.open, which is not the same thing as the
built-in open function.

the solution?  use "import os", and add "os." in front of all functions from
that module.  never use from-import in application code, unless you have
very good reasons:

    http://effbot.org/zone/import-confusion.htm#which-way-should-i-use

</F> 






More information about the Python-list mailing list