Hello
I believe this is really a python problem as compared to a visual python problem but I hope someone out there may know the answer. I am trying to send formated output to the screen and to a file.
print "k = %10.5f w = %10.5f Q = %10.5f wh = %10.5f\n" % (k, w, Q, wh)
fprev.write ('k = %10.5f w = %10.5f Q = %10.5f wh = %10.5f\n' % (k, w, Q, wh))
The variables k, w, Q, and wh are real floating point numbers. If I execute an unformated print statement before trying to execute the formated statement, the values are what I expected, (k = 0.001, w = 1.0, Q = 1.0e2, wh = 0.0) The formated statements work in a different version of the program. When I moved the statements into a function the following error occured.
Exception in Tkinter callback
Traceback (innermost last):
File "c:\Python\Lib\lib-tk\Tkinter.py", line 764, in __call__
return apply(self.func, args)
File "c:\python\programs\graph1.py", line 152, in run
print " k = %10.5f w = %10.5f Q = %10.5f wh = %10.5f\n" % (k, w, Q, wh)
TypeError: illegal argument type for built-in operation
Any suggestions will be appreciated.
Thanks
Dave Porter
|