qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] scripts: Fix undefinited name 'file' error for python3
       [not found] ` <CAHjf+S_miSm8ygAadObVnif1LKejA=j9OFae+OV5Oe-TedByyQ@mail.gmail.com>
@ 2019-12-04  6:48   ` Han Han
  2019-12-04  8:23     ` Thomas Huth
  0 siblings, 1 reply; 3+ messages in thread
From: Han Han @ 2019-12-04  6:48 UTC (permalink / raw)
  To: qemu-trivial; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 2583 bytes --]

Anyone help to review it?

On Tue, Nov 26, 2019 at 1:54 PM Han Han <hhan@redhat.com> wrote:

> ping
>
> On Wed, Nov 13, 2019 at 9:17 PM Han Han <hhan@redhat.com> wrote:
>
>> In python3, 'file' is no longer a keyword for file type object. So it
>> will can error when run the scripts by python3:
>>
>> $ python3 ./scripts/vmstate-static-checker.py -s 4.0.json -d 4.1.json
>> Traceback (most recent call last):
>>   File "./scripts/vmstate-static-checker.py", line 431, in <module>
>>     sys.exit(main())
>>   File "./scripts/vmstate-static-checker.py", line 378, in main
>>     parser.add_argument('-s', '--src', type=file, required=True,
>> NameError: name 'file' is not defined
>>
>> Replace file type to argparse.FileType('r').
>>
>> Signed-off-by: Han Han <hhan@redhat.com>
>> ---
>>  scripts/vmstate-static-checker.py | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/scripts/vmstate-static-checker.py
>> b/scripts/vmstate-static-checker.py
>> index d3467288..14f199a0 100755
>> --- a/scripts/vmstate-static-checker.py
>> +++ b/scripts/vmstate-static-checker.py
>> @@ -375,9 +375,9 @@ def main():
>>      help_text = "Parse JSON-formatted vmstate dumps from QEMU in files
>> SRC and DEST.  Checks whether migration from SRC to DEST QEMU versions
>> would break based on the VMSTATE information contained within the JSON
>> outputs.  The JSON output is created from a QEMU invocation with the
>> -dump-vmstate parameter and a filename argument to it.  Other parameters to
>> QEMU do not matter, except the -M (machine type) parameter."
>>
>>      parser = argparse.ArgumentParser(description=help_text)
>> -    parser.add_argument('-s', '--src', type=file, required=True,
>> +    parser.add_argument('-s', '--src', type=argparse.FileType('r'),
>> required=True,
>>                          help='json dump from src qemu')
>> -    parser.add_argument('-d', '--dest', type=file, required=True,
>> +    parser.add_argument('-d', '--dest', type=argparse.FileType('r'),
>> required=True,
>>                          help='json dump from dest qemu')
>>      parser.add_argument('--reverse', required=False, default=False,
>>                          action='store_true',
>> --
>> 2.23.0
>>
>>
>
> --
> Best regards,
> -----------------------------------
> Han Han
> Quality Engineer
> Redhat.
>
> Email: hhan@redhat.com
> Phone: +861065339333
>


-- 
Best regards,
-----------------------------------
Han Han
Quality Engineer
Redhat.

Email: hhan@redhat.com
Phone: +861065339333

[-- Attachment #2: Type: text/html, Size: 3944 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scripts: Fix undefinited name 'file' error for python3
  2019-12-04  6:48   ` [PATCH] scripts: Fix undefinited name 'file' error for python3 Han Han
@ 2019-12-04  8:23     ` Thomas Huth
  2019-12-04  8:34       ` Han Han
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Huth @ 2019-12-04  8:23 UTC (permalink / raw)
  To: Han Han, qemu-trivial; +Cc: qemu-devel, Dr. David Alan Gilbert, Eduardo Habkost

On 04/12/2019 07.48, Han Han wrote:
> Anyone help to review it?

 Hi!

When sending patches to the qemu-devel mailing list, please always make
sure to put the corresponding maintainers on CC:, otherwise your mails
might get lost in the high traffic of the mailing list. For this case,
it would have been good to CC: the "Migration" and "Python script"
maintainers, see the corresponding sections of the MAINTAINERS file in
the top most directory of the QEMU sources.

Anyway, it seems someone else ran into the same issue already, too, and
 it got already fixed here:

https://git.qemu.org/?p=qemu.git;a=commitdiff;h=e8d0ac5801edda91412e5

  Thomas


> On Tue, Nov 26, 2019 at 1:54 PM Han Han <hhan@redhat.com
> <mailto:hhan@redhat.com>> wrote:
> 
>     ping
> 
>     On Wed, Nov 13, 2019 at 9:17 PM Han Han <hhan@redhat.com
>     <mailto:hhan@redhat.com>> wrote:
> 
>         In python3, 'file' is no longer a keyword for file type object.
>         So it
>         will can error when run the scripts by python3:
> 
>         $ python3 ./scripts/vmstate-static-checker.py -s 4.0.json -d
>         4.1.json
>         Traceback (most recent call last):
>           File "./scripts/vmstate-static-checker.py", line 431, in <module>
>             sys.exit(main())
>           File "./scripts/vmstate-static-checker.py", line 378, in main
>             parser.add_argument('-s', '--src', type=file, required=True,
>         NameError: name 'file' is not defined
> 
>         Replace file type to argparse.FileType('r').
> 
>         Signed-off-by: Han Han <hhan@redhat.com <mailto:hhan@redhat.com>>
>         ---
>          scripts/vmstate-static-checker.py | 4 ++--
>          1 file changed, 2 insertions(+), 2 deletions(-)
> 
>         diff --git a/scripts/vmstate-static-checker.py
>         b/scripts/vmstate-static-checker.py
>         index d3467288..14f199a0 100755
>         --- a/scripts/vmstate-static-checker.py
>         +++ b/scripts/vmstate-static-checker.py
>         @@ -375,9 +375,9 @@ def main():
>              help_text = "Parse JSON-formatted vmstate dumps from QEMU
>         in files SRC and DEST.  Checks whether migration from SRC to
>         DEST QEMU versions would break based on the VMSTATE information
>         contained within the JSON outputs.  The JSON output is created
>         from a QEMU invocation with the -dump-vmstate parameter and a
>         filename argument to it.  Other parameters to QEMU do not
>         matter, except the -M (machine type) parameter."
> 
>              parser = argparse.ArgumentParser(description=help_text)
>         -    parser.add_argument('-s', '--src', type=file, required=True,
>         +    parser.add_argument('-s', '--src',
>         type=argparse.FileType('r'), required=True,
>                                  help='json dump from src qemu')
>         -    parser.add_argument('-d', '--dest', type=file, required=True,
>         +    parser.add_argument('-d', '--dest',
>         type=argparse.FileType('r'), required=True,
>                                  help='json dump from dest qemu')
>              parser.add_argument('--reverse', required=False, default=False,
>                                  action='store_true',
>         -- 
>         2.23.0
> 
> 
> 
> -- 
> Best regards,
> -----------------------------------
> Han Han
> Quality Engineer
> Redhat.
> 
> Email: hhan@redhat.com <mailto:hhan@redhat.com>
> Phone: +861065339333



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scripts: Fix undefinited name 'file' error for python3
  2019-12-04  8:23     ` Thomas Huth
@ 2019-12-04  8:34       ` Han Han
  0 siblings, 0 replies; 3+ messages in thread
From: Han Han @ 2019-12-04  8:34 UTC (permalink / raw)
  To: Thomas Huth
  Cc: qemu-trivial, qemu-devel, Dr. David Alan Gilbert, Eduardo Habkost

[-- Attachment #1: Type: text/plain, Size: 3931 bytes --]

On Wed, Dec 4, 2019 at 4:23 PM Thomas Huth <thuth@redhat.com> wrote:

> On 04/12/2019 07.48, Han Han wrote:
> > Anyone help to review it?
>
>  Hi!
>
> When sending patches to the qemu-devel mailing list, please always make
> sure to put the corresponding maintainers on CC:, otherwise your mails
> might get lost in the high traffic of the mailing list. For this case,
> it would have been good to CC: the "Migration" and "Python script"
> maintainers, see the corresponding sections of the MAINTAINERS file in
> the top most directory of the QEMU sources.
>
OK. Thanks for your advice

>
> Anyway, it seems someone else ran into the same issue already, too, and
>  it got already fixed here:
>
> https://git.qemu.org/?p=qemu.git;a=commitdiff;h=e8d0ac5801edda91412e5
>
>   Thomas
>
>
> > On Tue, Nov 26, 2019 at 1:54 PM Han Han <hhan@redhat.com
> > <mailto:hhan@redhat.com>> wrote:
> >
> >     ping
> >
> >     On Wed, Nov 13, 2019 at 9:17 PM Han Han <hhan@redhat.com
> >     <mailto:hhan@redhat.com>> wrote:
> >
> >         In python3, 'file' is no longer a keyword for file type object.
> >         So it
> >         will can error when run the scripts by python3:
> >
> >         $ python3 ./scripts/vmstate-static-checker.py -s 4.0.json -d
> >         4.1.json
> >         Traceback (most recent call last):
> >           File "./scripts/vmstate-static-checker.py", line 431, in
> <module>
> >             sys.exit(main())
> >           File "./scripts/vmstate-static-checker.py", line 378, in main
> >             parser.add_argument('-s', '--src', type=file, required=True,
> >         NameError: name 'file' is not defined
> >
> >         Replace file type to argparse.FileType('r').
> >
> >         Signed-off-by: Han Han <hhan@redhat.com <mailto:hhan@redhat.com
> >>
> >         ---
> >          scripts/vmstate-static-checker.py | 4 ++--
> >          1 file changed, 2 insertions(+), 2 deletions(-)
> >
> >         diff --git a/scripts/vmstate-static-checker.py
> >         b/scripts/vmstate-static-checker.py
> >         index d3467288..14f199a0 100755
> >         --- a/scripts/vmstate-static-checker.py
> >         +++ b/scripts/vmstate-static-checker.py
> >         @@ -375,9 +375,9 @@ def main():
> >              help_text = "Parse JSON-formatted vmstate dumps from QEMU
> >         in files SRC and DEST.  Checks whether migration from SRC to
> >         DEST QEMU versions would break based on the VMSTATE information
> >         contained within the JSON outputs.  The JSON output is created
> >         from a QEMU invocation with the -dump-vmstate parameter and a
> >         filename argument to it.  Other parameters to QEMU do not
> >         matter, except the -M (machine type) parameter."
> >
> >              parser = argparse.ArgumentParser(description=help_text)
> >         -    parser.add_argument('-s', '--src', type=file, required=True,
> >         +    parser.add_argument('-s', '--src',
> >         type=argparse.FileType('r'), required=True,
> >                                  help='json dump from src qemu')
> >         -    parser.add_argument('-d', '--dest', type=file,
> required=True,
> >         +    parser.add_argument('-d', '--dest',
> >         type=argparse.FileType('r'), required=True,
> >                                  help='json dump from dest qemu')
> >              parser.add_argument('--reverse', required=False,
> default=False,
> >                                  action='store_true',
> >         --
> >         2.23.0
> >
> >
> >
> > --
> > Best regards,
> > -----------------------------------
> > Han Han
> > Quality Engineer
> > Redhat.
> >
> > Email: hhan@redhat.com <mailto:hhan@redhat.com>
> > Phone: +861065339333
>
>

-- 
Best regards,
-----------------------------------
Han Han
Quality Engineer
Redhat.

Email: hhan@redhat.com
Phone: +861065339333

[-- Attachment #2: Type: text/html, Size: 6098 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-12-04  8:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20191113131655.307847-1-hhan@redhat.com>
     [not found] ` <CAHjf+S_miSm8ygAadObVnif1LKejA=j9OFae+OV5Oe-TedByyQ@mail.gmail.com>
2019-12-04  6:48   ` [PATCH] scripts: Fix undefinited name 'file' error for python3 Han Han
2019-12-04  8:23     ` Thomas Huth
2019-12-04  8:34       ` Han Han

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).