Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'enabling': 0.05; 'binary': 0.07; 'defaults': 0.07; 'modified': 0.07; 'see:': 0.07; 'socket': 0.07; 'indicates': 0.09; 'mixed': 0.09; 'part,': 0.09; 'replication': 0.09; 'skip:/ 10': 0.09; 'subject:script': 0.09; 'tcp/ip': 0.09; 'systems.': 0.12; 'changes': 0.15; 'windows': 0.15; "'client',": 0.16; '(default)': 0.16; '(via': 0.16; 'help?': 0.16; 'localhost': 0.16; 'locations.': 0.16; 'sockets': 0.16; 'subject:python': 0.16; 'all.': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'deployment': 0.19; 'file,': 0.19; 'memory': 0.22; 'example': 0.22; 'email addr:gmail.com>': 0.22; 'to:name :python-list@python.org': 0.22; 'error': 0.23; '(such': 0.24; 'config': 0.24; 'entries': 0.24; 'script.': 0.24; "shouldn't": 0.24; 'url:dev': 0.24; 'mon,': 0.24; 'looks': 0.24; "i've": 0.25; 'options': 0.25; 'script': 0.25; '>': 0.26; 'logging': 0.26; 'skip:" 30': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'raise': 0.29; 'unix': 0.29; "doesn't": 0.30; 'locations': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'url:mailman': 0.30; 'asked': 0.31; 'code': 0.31; 'getting': 0.31; 'follows': 0.31; 'omitted': 0.31; 'option)': 0.31; 'option.': 0.31; 'username': 0.31; 'anyone': 0.31; 'file': 0.32; 'option': 0.32; 'run': 0.32; 'linux': 0.33; 'url:python': 0.33; 'running': 0.33; '(most': 0.33; 'monday,': 0.33; 'skip:# 10': 0.33; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'interaction': 0.36; 'object,': 0.36; 'url:listinfo': 0.36; 'thanks': 0.36; 'similar': 0.36; 'url:org': 0.36; 'server': 0.38; 'skip:& 10': 0.38; 'thank': 0.38; 'skip:[ 10': 0.38; 'whatever': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'pm,': 0.38; 'little': 0.38; 'recent': 0.39; 'skip:& 20': 0.39; 'to:addr:python.org': 0.39; 'changed': 0.39; 'url:mail': 0.40; 'read': 0.60; 'new': 0.61; 'simple': 0.61; "you've": 0.63; 'information': 0.63; 'skip:n 10': 0.64; 'here': 0.66; 'between': 0.67; 'helping': 0.70; 'configparser': 0.84; 'plays': 0.84; 'want:': 0.84; 'hill': 0.95; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=Io8bOKqzPf7Y2PyhTyGujfU86KwZ4FbX78IVJ8CydXM=; b=Au+hdLEgDqqfBkds89aNat7Y/jS51Hnf4/cSXjwzU6gRQwnp0vpHkajl2jYiuQfiZ8 AK+UAX8ibkZ12eazNEiAFnKIkoNaDWN/RRSIgg9DcgOSLN7X7bliK+STLuLJqxieVXoM Cru5hiIgTkUscWPy2HXqd9zlBCRuQbGoTuq3rddpNYcs4gJMaIig7zyBcfQZGVcs3BMT J9RIE9BS442GFIa8EaIjimBHplh+Wnsk4tRKk/MnJx1zt8t7z55wk8kuscsGVX8bRZ4f joiU9n86abbWNO/cLEu57g6AwVjRyXDdqQLL0ndaZHRFCfKZuJD7WBCceAVIKTc+QPqO eiTQ== X-Received: by 10.182.96.37 with SMTP id dp5mr5882624obb.93.1367874521154; Mon, 06 May 2013 14:08:41 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <489bad9e-4a96-4d51-98ea-ce59c2573e4f@googlegroups.com> References: <51f5c8c4-b40b-4a1e-b72b-905caa62aaf6@googlegroups.com> <489bad9e-4a96-4d51-98ea-ce59c2573e4f@googlegroups.com> From: Matt Jones Date: Mon, 6 May 2013 16:08:20 -0500 Subject: Re: python backup script To: "python-list@python.org" Content-Type: multipart/alternative; boundary=001a11c2ab98ee989a04dc131abd X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 581 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1367874530 news.xs4all.nl 15961 [2001:888:2000:d::a6]:50167 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:44852 --001a11c2ab98ee989a04dc131abd Content-Type: text/plain; charset=ISO-8859-1 Why do you have to use that file? Why can't you copy its contents into a new file in your working directory and make whatever changes necessary? Example of the changes your code makes me think you want: ************************ # The following options will be passed to all MySQL clients [client] #password = your_password port = 3306 socket = /tmp/mysql.sock mmz = bleh pass1 = blah localhost = bluargh *Matt Jones* On Mon, May 6, 2013 at 3:37 PM, MMZ wrote: > Thanks Matt. > my.cnf is a readonly file and cannot be changed or modified but do you > know of a file that stores similar information on CentOS?I think I'm not > reading from a right file maybe. > > On Monday, May 6, 2013 3:46:04 PM UTC-4, Matt Jones wrote: > > I've never used ConfigParser either, but shouldn't the "[client]" > section have the options "mmz", "pass1", or "localhost" somewhere? Do you > need to add them to that file? > > > > > > > > > > Matt Jones > > > > > > > > On Mon, May 6, 2013 at 2:20 PM, MMZ wrote: > > > > > > On Monday, May 6, 2013 3:11:33 PM UTC-4, Jerry Hill wrote: > > > > > > > On Mon, May 6, 2013 at 3:01 PM, MMZ wrote: > > > > > > > > > > > > > > > > > > > > I am trying to backup database on CentOS linux server,I'm getting > error when running the following script. anyone can help? > > > > > > > > > > > > > > > > > > > > > > > > > > > Traceback (most recent call last): > > > > > > > > > > File "./backup.py", line 8, in ? > > > > > > > > > > username = config.get('client', 'mmz') > > > > > > > > > > File "/usr/lib/python2.4/ConfigParser.py", line 511, in get > > > > > > > > > > raise NoSectionError(section) > > > > > > > > > > > > > > > > > > > > > > I've never used ConfigParser, but that > > > > > > > > > > error message looks pretty simple to interpret. You've set up a > ConfigParser object, told it to read in ~/my.cnf, the asked for the value > of section 'client', option 'mmz'. The error indicates that your config > files doesn't have a section named 'client'. > > > > > > > > > > > > > > > > > > > > > > > > What is the content of your ~/my.cnf file? > > > > > > > > > > -- > > > > > > > > > > > > > > > Jerry > > > > > > > > Thank you for helping Jerry. Actually I found this script for debian but > I want to use it for CentOS server so I replaced /etc/mysql/debian.cnf with > ~/my.cnf > > > > the file content is: > > > > > > > > Example MySQL config file for medium systems. > > > > # > > > > # This is for a system with little memory (32M - 64M) where MySQL plays > > > > # an important part, or systems up to 128M where MySQL is used together > with > > > > # other programs (such as a web server) > > > > # > > > > # MySQL programs look for option files in a set of > > > > # locations which depend on the deployment platform. > > > > # You can copy this option file to one of those > > > > # locations. For information about these locations, see: > > > > # http://dev.mysql.com/doc/mysql/en/option-files.html > > > > # > > > > # In this file, you can use all long options that a program supports. > > > > # If you want to know which options a program supports, run the program > > > > # with the "--help" option. > > > > > > > > # The following options will be passed to all MySQL clients > > > > [client] > > > > #password = your_password > > > > port = 3306 > > > > socket = /tmp/mysql.sock > > > > > > > > # Here follows entries for some specific programs > > > > > > > > # The MySQL server > > > > [mysqld] > > > > port = 3306 > > > > socket = /tmp/mysql.sock > > > > skip-locking > > > > key_buffer_size = 16M > > > > max_allowed_packet = 1M > > > > table_open_cache = 64 > > > > sort_buffer_size = 512K > > > > net_buffer_length = 8K > > > > read_buffer_size = 256K > > > > read_rnd_buffer_size = 512K > > > > myisam_sort_buffer_size = 8M > > > > > > > > # Don't listen on a TCP/IP port at all. This can be a security > enhancement, > > > > # if all processes that need to connect to mysqld run on the same host. > > > > # All interaction with mysqld must be made via Unix sockets or named > pipes. > > > > # Note that using this option without enabling named pipes on Windows > > > > # (via the "enable-named-pipe" option) will render mysqld useless! > > > > # > > > > #skip-networking > > > > > > > > # Replication Master Server (default) > > > > # binary logging is required for replication > > > > log-bin=mysql-bin > > > > > > > > # binary logging format - mixed recommended > > > > binlog_format=mixed > > > > > > > > # required unique id between 1 and 2^32 - 1 > > > > # defaults to 1 if master-host is not set > > > > # but will not function as a master if omitted > > > > server-id = 1 > > > > -- > > > > http://mail.python.org/mailman/listinfo/python-list > > -- > http://mail.python.org/mailman/listinfo/python-list > --001a11c2ab98ee989a04dc131abd Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Why do you have to use that file?= =A0Why can't you copy its contents into a new file in your working dir= ectory and make whatever changes necessary?


Example of the changes your code makes me think you want:

************************
# The following= options will be passed to all MySQL clients
[client]
#password =A0 =A0 =A0 =3D your_password<= br style=3D"color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px= "> port =A0 =A0 =A0 =A0 =A0 =A0=3D 3306
socket =A0 =A0 =A0 = =A0 =A0=3D /tmp/mysql.sock
mmz=A0=A0 =A0 = =A0 =A0 =A0=3D=A0bleh
pass1 =A0 =A0 =A0 =A0 =A0=3D=A0blah
localhost =A0 =A0 =A0 =A0 =A0=3D= =A0bluargh


Matt Jones


On Mon, May 6, 2013 at 3:37 PM, MMZ <programmer.toronto@gmail.com> wrote:
Thanks Matt.
my.cnf is a readonly file and cannot be changed or modified but do you know= of a file that stores similar information on CentOS?I think I'm not re= ading from a right file maybe.

On Monday, May 6, 2013 3:46:04 PM UTC-4, Matt Jones wrote:
> I've never used ConfigParser either, but shouldn't the "[= client]" section have the options "mmz", "pass1", = or "localhost" somewhere? =A0Do you need to add them to that file= ?
>
>
>
>
> Matt Jones
>
>
>
> On Mon, May 6, 2013 at 2= :20 PM, MMZ <programme...@gmai= l.com> wrote:
>
>
> On Monday, May 6, 2013 3:11:33 PM UTC-4, Jerry Hill wrote:
>
>
> > On Mon, May 6, 2013 at 3:01 PM, MMZ <programme...@gmail.com> wrote:
>
> >
>
> >
>
> >
>
> > I am trying to backup database on CentOS linux server,I'm get= ting error when running the following script. anyone can help?
>
> >
>
> >
>
> >
>
> >
>
>
> > Traceback (most recent call last):
>
> >
>
> > =A0 File "./backup.py", line 8, in ?
>
> >
>
> > =A0 =A0 username =3D config.get('client', 'mmz')<= br> >
> >
>
> > =A0 File "/usr/lib/python2.4/ConfigParser.py", line 511= , in get
>
> >
>
> > =A0 =A0 raise NoSectionError(section)
>
> >
>
> >
>
> >
>
>
> > I've never used ConfigParser, but that =A0
>
> >
>
> > error message looks pretty simple to interpret.=A0 You've set= up a ConfigParser object, told it to read in ~/my.cnf, the asked for the v= alue of section 'client', option 'mmz'.=A0 The error indica= tes that your config files doesn't have a section named 'client'= ;.
>
>
>
> >
>
> >
>
> >
>
> > What is the content of your ~/my.cnf file?
>
> >
>
> > --
>
> >
>
> >
>
> > Jerry
>
>
>
> Thank you for helping Jerry. Actually I found this script for debian b= ut I want to use it for CentOS server so I replaced /etc/mysql/debian.cnf w= ith ~/my.cnf
>
> the file content is:
>
>
>
> =A0Example MySQL config file for medium systems.
>
> #
>
> # This is for a system with little memory (32M - 64M) where MySQL play= s
>
> # an important part, or systems up to 128M where MySQL is used togethe= r with
>
> # other programs (such as a web server)
>
> #
>
> # MySQL programs look for option files in a set of
>
> # locations which depend on the deployment platform.
>
> # You can copy this option file to one of those
>
> # locations. For information about these locations, see:
>
> # http://dev.mysql.com/doc/mysql/en/option-files.html
>
> #
>
> # In this file, you can use all long options that a program supports.<= br> >
> # If you want to know which options a program supports, run the progra= m
>
> # with the "--help" option.
>
>
>
> # The following options will be passed to all MySQL clients
>
> [client]
>
> #password =A0 =A0 =A0 =3D your_password
>
> port =A0 =A0 =A0 =A0 =A0 =A0=3D 3306
>
> socket =A0 =A0 =A0 =A0 =A0=3D /tmp/mysql.sock
>
>
>
> # Here follows entries for some specific programs
>
>
>
> # The MySQL server
>
> [mysqld]
>
> port =A0 =A0 =A0 =A0 =A0 =A0=3D 3306
>
> socket =A0 =A0 =A0 =A0 =A0=3D /tmp/mysql.sock
>
> skip-locking
>
> key_buffer_size =3D 16M
>
> max_allowed_packet =3D 1M
>
> table_open_cache =3D 64
>
> sort_buffer_size =3D 512K
>
> net_buffer_length =3D 8K
>
> read_buffer_size =3D 256K
>
> read_rnd_buffer_size =3D 512K
>
> myisam_sort_buffer_size =3D 8M
>
>
>
> # Don't listen on a TCP/IP port at all. This can be a security enh= ancement,
>
> # if all processes that need to connect to mysqld run on the same host= .
>
> # All interaction with mysqld must be made via Unix sockets or named p= ipes.
>
> # Note that using this option without enabling named pipes on Windows<= br> >
> # (via the "enable-named-pipe" option) will render mysqld us= eless!
>
> #
>
> #skip-networking
>
>
>
> # Replication Master Server (default)
>
> # binary logging is required for replication
>
> log-bin=3Dmysql-bin
>
>
>
> # binary logging format - mixed recommended
>
> binlog_format=3Dmixed
>
>
>
> # required unique id between 1 and 2^32 - 1
>
> # defaults to 1 if master-host is not set
>
> # but will not function as a master if omitted
>
> server-id =A0 =A0 =A0 =3D 1
>
> --
>
> http://mail.python.org/mailman/listinfo/python-list

--
http://mail.python.org/mailman/listinfo/python-list

--001a11c2ab98ee989a04dc131abd--