All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [XTF PATCH v2] xtf-runner: support two modes for getting output
Date: Thu, 11 Aug 2016 18:23:52 +0100	[thread overview]
Message-ID: <20160811172352.GE20641@citrix.com> (raw)
In-Reply-To: <a2114f65-5762-e844-7706-01aac4ab11ca@citrix.com>

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@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2016-08-11 17:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-11 14:14 [XTF PATCH v2] xtf-runner: support two modes for getting output Wei Liu
2016-08-11 16:27 ` Ian Jackson
2016-08-11 16:50   ` Wei Liu
2016-08-11 17:17     ` Ian Jackson
2016-08-11 17:21       ` Andrew Cooper
2016-08-11 17:23         ` Wei Liu [this message]
2016-08-11 17:51       ` Wei Liu
2016-08-11 17:54         ` Andrew Cooper
2016-08-11 18:29           ` Ian Jackson
2016-08-12  9:23             ` Wei Liu
2016-08-12  9:51               ` Ian Jackson
2016-08-12 13:28                 ` Wei Liu
2016-08-15 10:58                 ` Wei Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160811172352.GE20641@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.