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

Bernard Lebel 3dbernard at gmail.com
Mon Jan 2 20:13:58 CET 2006


(sorry for the truncated email, having big problems with internet)

The __nodeLog() method looks like this:


def __nodeLog( self, sMsg, iLevel ):

	"""
	Write a line from the script in its node log.
	
	ARGUMENTS:
	sMsg (string): the message to print
	iLevel (integer): the verbosity level
	"""
	
	if iLevel <= self.loglevel:
		
		sPrint = '%s %s [jobid: %s]: %s\n' % ( self.name, time.ctime(),
self.globaljobid, sMsg )
		print sPrint
		
		self.nodelog = file( os.path.join( self.nodelogs, '%s.log' % (
self.name ) ), 'a+' )
		self.nodelog.write( sPrint )
		self.nodelog.close()


Bernard



On 1/2/06, Bernard Lebel <3dbernard at gmail.com> wrote:
> The __nodeLog() method looks like this:
>
>
>
> On 1/2/06, Bernard Lebel <3dbernard at gmail.com> wrote:
> > Hello,
> >
> > I am getting an IOError, and I have a hard time getting information
> > about its meaning. Here is the full trace stack:
> >
> > Traceback (most recent call last):
> >
> >   File "X:\FARM\PYTHON\DEV\farmclient_2.0_beta03.py", line 1448, in ?
> >     client.start()
> >
> >   File "X:\FARM\PYTHON\DEV\farmclient_2.0_beta03.py", line 188, in start
> >     tGlobalRow = self.__standardQuery( "SELECT Status FROM
> > TB_CURRENT_JOBS WHERE ID = '%s'" % ( self.globaljobid ), 'SELECT', 1 )
> >
> >   File "X:\FARM\PYTHON\DEV\farmclient_2.0_beta03.py", line 524, in
> > __standardQuery
> >     self.__nodeLog( 'Query result: %s' % (str( tRow )), 4 )
> >
> >   File "X:\FARM\PYTHON\DEV\farmclient_2.0_beta03.py", line 1342, in __nodeLog
> >     self.nodelog.close()
> > IOError: (0, 'Error')
> >
> >
> > "self.nodelog" is a text file located on the network, that is open in "a+" mode.
> >
> > 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 or
> > so. In this case, every query to a MySQL database is printed, plus a
> > few lines about the instance attributes.
> >
> > I have looked the built-in exception page in the Python docs, but I
> > could not find the meaning of "0", and, well, 'Error' is not exactly a
> > very descriptive term.
> >
> >
> > Anyone has any idea how I can do something with this error?
> >
> >
> > Thanks
> > Bernard
> >
>


More information about the Tutor mailing list