Re: [PATCH 2/3] tools/kvm_stat: Don't use deprecated file()

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

 



On 23.03.2018 23:07, Cole Robinson wrote:
> $ python3 tools/kvm/kvm_stat/kvm_stat
> Traceback (most recent call last):
>   File "tools/kvm/kvm_stat/kvm_stat", line 1668, in <module>
>     main()
>   File "tools/kvm/kvm_stat/kvm_stat", line 1639, in main
>     assign_globals()
>   File "tools/kvm/kvm_stat/kvm_stat", line 1618, in assign_globals
>     for line in file('/proc/mounts'):
> NameError: name 'file' is not defined
> 
> open() is the python3 way, and works on python2.6+
> 
> Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx>
> ---
>  tools/kvm/kvm_stat/kvm_stat | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat
> index 645d4bb69f5f..651b7f08bb2c 100755
> --- a/tools/kvm/kvm_stat/kvm_stat
> +++ b/tools/kvm/kvm_stat/kvm_stat
> @@ -1615,7 +1615,7 @@ def assign_globals():
>      global PATH_DEBUGFS_TRACING
> 
>      debugfs = ''
> -    for line in file('/proc/mounts'):
> +    for line in open('/proc/mounts'):
>          if line.split(' ')[0] == 'debugfs':
>              debugfs = line.split(' ')[1]
>              break
> 

Reviewed-and-tested-by: Stefan Raspl <stefan.raspl@xxxxxxxxxxxxxxxxxx>




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux