python backup script

Chris Angelico rosuav at gmail.com
Mon May 6 18:12:28 EDT 2013


On Tue, May 7, 2013 at 5:01 AM, MMZ <programmer.toronto at gmail.com> wrote:
> username = config.get('client', 'mmz')
> password = config.get('client', 'pass1')
> hostname = config.get('client', 'localhost')

Are 'mmz', 'pass1', and 'localhost' the actual values you want for
username, password, and hostname? If so, don't pass them through
config.get() at all - just use them directly. In fact, I'd be inclined
to just stuff them straight into the Database_list_command literal;
that way, it's clear how they're used, and the fact that you aren't
escaping them in any way isn't going to be a problem (tip: an
apostrophe in your password would currently break your script).

It's also worth noting that the ~/ notation is a shell feature. You
may or may not be able to use it in config.read().

ChrisA



More information about the Python-list mailing list