On Mon, Jul 17, 2017 at 03:18:35PM +0800, Fam Zheng wrote: > On Sun, 07/16 02:13, Ishani Chugh wrote: > > +""" > > +This file is an implementation of backup tool > > +""" > > +from argparse import ArgumentParser > > +import os > > +import errno > > +from socket import error as socket_error > > +import configparser > > Python2 has ConfigParser while python3 has configparser. Please be specific > about the python compatibility level of this script - my system (Fedora) has > python2 as /usr/bin/python, so the shebang and your example command in the > commit message don't really work. "six" module can handle python 2/3 > differentiations, or you can use '#!/usr/bin/env python2' to specify a python > version explicitly.
I haven't compared Python 2 ConfigParser and Python 3 configparser in detail, but I they have a common API subset. It should be possible to do something like: try: from configparser import ConfigParser # Python 3 except ImportError: from ConfigParser import ConfigParser # Python 2 > > +from qmp import QEMUMonitorProtocol > > + > > + > > +class BackupTool(object): > > + """BackupTool Class""" > > + def __init__(self, config_file='backup.ini'): > > Is it better to put this in a more predictable place such as > "$HOME/.qemu-backup.ini" and/or make it a command line option? Yes, it's common to take a configuration file path on the command-line with a default value of $HOME/.program-name if no command-line option was given.
signature.asc
Description: PGP signature