DebugClients/Python/AsyncFile.py

changeset 2953
703452a2876f
parent 2434
c148e2b8188d
child 2987
c99695c0f13a
equal deleted inserted replaced
2952:94fc661a54a2 2953:703452a2876f
58 58
59 This method checks, if an operation is permitted according to 59 This method checks, if an operation is permitted according to
60 the mode of the file. If it is not, an IOError is raised. 60 the mode of the file. If it is not, an IOError is raised.
61 61
62 @param mode the mode to be checked (string) 62 @param mode the mode to be checked (string)
63 @exception IOError raised to indicate a bad file descriptor
63 """ 64 """
64 if mode != self.mode: 65 if mode != self.mode:
65 raise IOError('[Errno 9] Bad file descriptor') 66 raise IOError('[Errno 9] Bad file descriptor')
66 67
67 def __nWrite(self, n): 68 def __nWrite(self, n):
233 234
234 def seek(self, offset, whence=0): 235 def seek(self, offset, whence=0):
235 """ 236 """
236 Public method to move the filepointer. 237 Public method to move the filepointer.
237 238
239 @param offset offset to seek for
240 @param whence where to seek from
238 @exception IOError This method is not supported and always raises an 241 @exception IOError This method is not supported and always raises an
239 IOError. 242 IOError.
240 """ 243 """
241 raise IOError('[Errno 29] Illegal seek') 244 raise IOError('[Errno 29] Illegal seek')
242 245
251 254
252 def truncate(self, size=-1): 255 def truncate(self, size=-1):
253 """ 256 """
254 Public method to truncate the file. 257 Public method to truncate the file.
255 258
259 @param size size to truncate to (integer)
256 @exception IOError This method is not supported and always raises an 260 @exception IOError This method is not supported and always raises an
257 IOError. 261 IOError.
258 """ 262 """
259 raise IOError('[Errno 29] Illegal seek') 263 raise IOError('[Errno 29] Illegal seek')
260 264
261 def write(self, s): 265 def write(self, s):
262 """ 266 """
263 Public method to write a string to the file. 267 Public method to write a string to the file.
264 268
265 @param s bytes to be written (string) 269 @param s bytes to be written (string)
270 @exception socket.error raised to indicate too many send attempts
266 """ 271 """
267 self.__checkMode('w') 272 self.__checkMode('w')
268 tries = 0 273 tries = 0
269 if not self.wpending: 274 if not self.wpending:
270 self.wpending = s 275 self.wpending = s

eric ide

mercurial