[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [XTF PATCH v2] xtf-runner: support two modes for getting output



On Thu, Aug 11, 2016 at 06:21:55PM +0100, Andrew Cooper wrote:
> On 11/08/16 18:17, Ian Jackson wrote:
> > Wei Liu writes ("Re: [XTF PATCH v2] xtf-runner: support two modes for 
> > getting output"):
> >> On Thu, Aug 11, 2016 at 05:27:56PM +0100, Ian Jackson wrote:
> >>> This is perverse.  Why not just open it O_CREAT|O_RDONLY ?  If Python
> >>> can't do that then unconditionally opening it O_CREAT|O_RDWR would do.
> >> The open call doesn't accept O_CREAT|O_RDONLY.
> > open("t", O_RDONLY|O_CREAT, 0666)       = 3
> >
> > But maybe you mean Python's open doesn't.
> 
> Use os.open() to get a Posix open, the os.fdopen(fd) to get a Python
> file object for the fd.
> 
> >
> >> Andy my experiment showed that "rb" doesn't create the file.
> > Yes, it wouldn't.  If you want a fopen mode, "a+" may be of some use.
> >
> >>>> +    logfile.seek(0, 2) # Go to end of file
> >>> Does Python not have SEEK_END somewhere ?
> >> There is one, but that's in os module.
> >> Python official document is using numeric values directly.
> > Seriously?  Fine, whatever.
> 
> os.SEEK_END is the proper way of doing this.  The documentation is
> presumably just being lazy.

Looks like switching to use os module should work better.

Wei.

> 
> ~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.