python backup script
MMZ
programmer.toronto at gmail.com
Mon May 6 18:40:40 EDT 2013
On Monday, May 6, 2013 6:12:28 PM UTC-4, Chris Angelico wrote:
> 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
Thanks Chris. you are right.
So I used them directly and removed configParser. The new error is:
Traceback (most recent call last):
File "./bbk.py", line 11, in ?
for database in os.popen(database_list_command).readlines():
NameError: name 'database_list_command' is not defined
any idea?
More information about the Python-list
mailing list