[Tutor] IOError: (0, 'Error')

Alan Gauld alan.gauld at freenet.co.uk
Tue Jan 3 01:43:13 CET 2006


I have no idea if this is the problem but one thing that might help is:

>  File "X:\FARM\PYTHON\DEV\farmclient_2.0_beta03.py", line 524, in
> __standardQuery
>    self.__nodeLog( 'Query result: %s' % (str( tRow )), 4 )

I'd add a comma to the formatting tuple since otherwise the
format operatror might get confused:

    self.__nodeLog( 'Query result: %s' % (str( tRow ),), 4 )

Note the comma vbefore the second last paren to force formatting
to see the string expression as a single element tuple. Otherwise the
parens just make it a single expression as paert of a tuple with the 4.
However if that was really the mistake I'd expect formatting to
complain about too many arguments...

>>> '%d%' % (4,5)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ValueError: incomplete format
>>>

So I don't really think thats the problem. Just a nice to do...

>  File "X:\FARM\PYTHON\DEV\farmclient_2.0_beta03.py", line 1342, in 
> __nodeLog
>    self.nodelog.close()
> IOError: (0, 'Error')

> Everytime the program has to add a line is added to the file, the file
> is open, appended, then closed, in order to be able to read it at any
> point in time.
> This set of operations can happen several times a second, like 1-10

10 transacrtions per second on a file is quite a lot, it would be easier to
create a log table in your database since you already have a connection
open and just add rows to that, you can then read the rows at any time
- while still writing new rows if need be.

Alan G. 



More information about the Tutor mailing list