469,898 Members | 1,733 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,898 developers. It's quick & easy.

Error using tkinter

Hi,

I am making a gui, in which specifiction are taken from user, which are
wriiten to a file. and that file will bw executed.

finalstr is a string

f = open('crossManual.sh','w')
f.write(finalstr)
f.close()

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
Plz tell me how to correct it.

Thanx in advance

Apr 18 '06 #1
2 1348
"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-confus...y-should-i-use

</F>

Apr 18 '06 #2
Thanx a lot, that was the problem

Apr 18 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by anuradha.k.r | last post: by
2 posts views Thread by Markus Franke | last post: by
5 posts views Thread by Otto Krüse | last post: by
5 posts views Thread by Ben Kovitz | last post: by
2 posts views Thread by BartlebyScrivener | last post: by
reply views Thread by Guilherme Polo | last post: by
3 posts views Thread by Anish Chapagain | last post: by
3 posts views Thread by J-Burns | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.