By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,837 Members | 1,667 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,837 IT Pros & Developers. It's quick & easy.

Error using tkinter

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
"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

P: n/a
Thanx a lot, that was the problem

Apr 18 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.