Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #44861

Re: python backup script

Newsgroups comp.lang.python
Date 2013-05-06 15:40 -0700
References <b586db98-78b2-40a6-9e1c-3d8b939657c8@googlegroups.com> <mailman.1388.1367878356.3114.python-list@python.org>
Message-ID <f71a2143-a379-4c0c-9bdb-1a8b2cb15d79@googlegroups.com> (permalink)
Subject Re: python backup script
From MMZ <programmer.toronto@gmail.com>

Show all headers | View raw


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@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?

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

python backup script MMZ <programmer.toronto@gmail.com> - 2013-05-06 12:01 -0700
  Re: python backup script Jerry Hill <malaclypse2@gmail.com> - 2013-05-06 15:11 -0400
    Re: python backup script MMZ <programmer.toronto@gmail.com> - 2013-05-06 12:20 -0700
      Re: python backup script Matt Jones <matt.walker.jones@gmail.com> - 2013-05-06 14:46 -0500
        Re: python backup script MMZ <programmer.toronto@gmail.com> - 2013-05-06 13:37 -0700
          Re: python backup script Matt Jones <matt.walker.jones@gmail.com> - 2013-05-06 16:08 -0500
  Re: python backup script Enrico 'Henryx' Bianchi <henryx_b@yahoo.it> - 2013-05-06 23:44 +0200
    Re: python backup script Enrico 'Henryx' Bianchi <henryx_b@yahoo.it> - 2013-05-06 23:48 +0200
      Re: python backup script mina@socialassets.org - 2013-05-06 15:12 -0700
        Re: python backup script John Gordon <gordon@panix.com> - 2013-05-06 22:15 +0000
          Re: python backup script Enrico 'Henryx' Bianchi <henryx_b@yahoo.it> - 2013-05-07 21:11 +0200
        Re: python backup script MRAB <python@mrabarnett.plus.com> - 2013-05-06 23:28 +0100
      Re: python backup script MMZ <programmer.toronto@gmail.com> - 2013-05-06 15:15 -0700
  Re: python backup script Chris Angelico <rosuav@gmail.com> - 2013-05-07 08:12 +1000
    Re: python backup script MMZ <programmer.toronto@gmail.com> - 2013-05-06 15:40 -0700
      Re: python backup script Chris Angelico <rosuav@gmail.com> - 2013-05-07 08:51 +1000
      Re: python backup script MRAB <python@mrabarnett.plus.com> - 2013-05-06 23:52 +0100
  Re: python backup script Peter Otten <__peter__@web.de> - 2013-05-07 08:18 +0200

csiph-web