plementation).
Despite those, yes I would very much prefer to use YAML as a
configuration format. (ConfigParser INI format is acceptable. JSON is
definitely not, because it has no simple way to put comments in the
file.)
--
\ “In the long run, the utility of all non-Free software |
On 27/03/19 2:44 AM, Grant Edwards wrote:
On 2019-03-26, Cameron Simpson wrote:
Like JSON, YAML etc are far far easier than XML for the reader.
If "far far easier than XML for the reader" is the bar, then we'll
have to keep "nailgun to the eyeballs" on the list...
That said, I agree with th
Thanks Cameron.
Dave,
March 26, 2019 12:39 AM, "Cameron Simpson" wrote:
> On 25Mar2019 23:24, Dave wrote:
>
>> On 3/25/19 10:58 PM, DL Neil wrote:
>>> On 26/03/19 1:10 PM, Dave wrote:
>>
>> I use Python3 3, and expected learning how to use conf
On 2019-03-26, Cameron Simpson wrote:
> Like JSON, YAML etc are far far easier than XML for the reader.
If "far far easier than XML for the reader" is the bar, then we'll
have to keep "nailgun to the eyeballs" on the list...
That said, I agree with the rest of Cameron's post: for simpler stuff
On 2019-03-26, DL Neil wrote:
> On 26/03/19 1:10 PM, Dave wrote:
>> I use Python3 3, and expected learning how to use configparser would be
>> no big deal. Well! Seems there is configparser, stdconfigparser, and
>> safeconfigparser, and multiple ways to set the section a
On 3/26/19 4:29 AM, Terry Reedy wrote:
On 3/25/2019 8:10 PM, Dave wrote:
I use Python3 3, and expected learning how to use configparser would
be no big deal. Well! Seems there is configparser, stdconfigparser, and
configparser is what IDLE uses. I would read the extra or deleted
features
On 3/25/2019 8:10 PM, Dave wrote:
I use Python3 3, and expected learning how to use configparser would be
no big deal. Well! Seems there is configparser, stdconfigparser, and
configparser is what IDLE uses. I would read the extra or deleted
features of the others and see if they apply to
On 25Mar2019 23:24, Dave wrote:
On 3/25/19 10:58 PM, DL Neil wrote:
On 26/03/19 1:10 PM, Dave wrote:
I use Python3 3, and expected learning how to use configparser
would be no big deal. Well! Seems there is configparser,
stdconfigparser, and safeconfigparser, and multiple ways to set
the
On 3/25/19 10:58 PM, DL Neil wrote:
Dave,
On 26/03/19 1:10 PM, Dave wrote:
I use Python3 3, and expected learning how to use configparser would
be no big deal. Well! Seems there is configparser, stdconfigparser,
and safeconfigparser, and multiple ways to set the section and entries
to the
Dave,
On 26/03/19 1:10 PM, Dave wrote:
I use Python3 3, and expected learning how to use configparser would be
no big deal. Well! Seems there is configparser, stdconfigparser, and
safeconfigparser, and multiple ways to set the section and entries to
the section. A little confusing. I
I use Python3 3, and expected learning how to use configparser would be
no big deal. Well! Seems there is configparser, stdconfigparser, and
safeconfigparser, and multiple ways to set the section and entries to
the section. A little confusing. I want to future-proof may code, so
what
On 2019-03-07 17:19, tony wrote:
> Python 3.5.3 (default, Sep 27 2018, 17:25:39)
> >>> "a\\nb".decode("string-escape")
> Traceback (most recent call last):
> File "", line 1, in
> AttributeError: 'str' object has no attribute 'decode'
Looks like bytestring.decode('unicode_escape') does what y
On Thursday, March 7, 2019 at 10:38:03 AM UTC-6, jim.wo...@gmail.com wrote:
> On Saturday, October 1, 2016 at 9:57:24 AM UTC-5, Thorsten Kampe wrote:
> > Hi,
> >
> > ConfigParser escapes `\n` in ini values as `\\n`. Is there a way to
> > signal to ConfigParser
On Saturday, October 1, 2016 at 9:57:24 AM UTC-5, Thorsten Kampe wrote:
> Hi,
>
> ConfigParser escapes `\n` in ini values as `\\n`. Is there a way to
> signal to ConfigParser that there is a line break?
>
> Thorsten
And now we know!
I think they should have named Pytho
er 1, 2016 at 6:25:16 PM UTC-4, Thorsten Kampe wrote:
>>>>> * Ben Finney (Sun, 02 Oct 2016 07:12:46 +1100)
>>>>>>
>>>>>> Thorsten Kampe writes:
>>>>>>
>>>>>>> ConfigParser escapes `\n` in ini values as
tony wrote:
>> On Saturday, October 1, 2016 at 7:41:40 PM UTC-5, Ned Batchelder wrote:
>>> If you want to have \n mean a newline in your config file, you can
>>> do the conversion after you read the value:
>>>
>>> >>> "a\\nb".decode("string-escape")
>>> 'a\nb'
> How does that translate t
> * Ben Finney (Sun, 02 Oct 2016 07:12:46 +1100)
> >>>>
> >>>> Thorsten Kampe writes:
> >>>>
> >>>>> ConfigParser escapes `\n` in ini values as `\\n`.
> >>>
> >>> Indenting solves the problem. I'd r
t;
>>>> Thorsten Kampe writes:
>>>>
>>>>> ConfigParser escapes `\n` in ini values as `\\n`.
>>>
>>> Indenting solves the problem. I'd rather keep it one line per value
>>> but it solves the problem.
>>
>> If you want to have \n
On Saturday, October 1, 2016 at 7:41:40 PM UTC-5, Ned Batchelder wrote:
> On Saturday, October 1, 2016 at 6:25:16 PM UTC-4, Thorsten Kampe wrote:
> > * Ben Finney (Sun, 02 Oct 2016 07:12:46 +1100)
> > >
> > > Thorsten Kampe writes:
> > >
> > > >
On 06/28/18 16:44, Steven D'Aprano wrote:
I agree with you that it's a bad idea.
Aside from the little fact that you described concerns about using Python
code for settings as "silly".
Umm, no. I said that worrying about arbitrary code execution in an
interpreted language seemed silly.
On Thu, 28 Jun 2018 10:58:36 -0700, Jim Lee wrote:
> On 06/28/18 07:30, Grant Edwards wrote:
>> I still maintain it's a bad idea to run arbitrary code found in
>> user-edited config files.
>>
>> There may be cases where somebody has figured out how to muck with a
>> config file that's shared among
On 06/28/18 07:30, Grant Edwards wrote:
I still maintain it's a bad idea to run arbitrary code found in
user-edited config files.
There may be cases where somebody has figured out how to muck with a
config file that's shared among multiple users, or has tricked
somebody into including somethin
On 06/28/18 00:46, Steven D'Aprano wrote:
Yes, attacks by trusted insiders are the hardest to defend against.
Betrayal of trust sucks. Trusted users with sufficient privileges could
just modify the source code of your application or of Python itself. They
could also attack your system in a tho
On 2018-06-28, Steven D'Aprano wrote:
> So why give them the ability to escalate their privilege to that of
> your application (which probably can do lots of things they can't
> do) by directly executing Python code they supply?
To be fair, that situation isn't common. The vast majority of
appl
On Wed, 27 Jun 2018 16:09:09 -0700, Jim Lee wrote:
> On 06/27/18 15:19, Steven D'Aprano wrote:
>> On Wed, 27 Jun 2018 12:15:23 -0700, Jim Lee wrote:
>>
>>> It seems a bit silly to me to worry about arbitrary code
>>> execution in
>>> an interpreted language like Python whose default runtim
On 06/27/18 15:19, Steven D'Aprano wrote:
On Wed, 27 Jun 2018 12:15:23 -0700, Jim Lee wrote:
It seems a bit silly to me to worry about arbitrary code execution
in
an interpreted language like Python whose default runtime execution
method is to parse the source code directly. An attac
On Wed, 27 Jun 2018 12:15:23 -0700, Jim Lee wrote:
> It seems a bit silly to me to worry about arbitrary code execution
> in
> an interpreted language like Python whose default runtime execution
> method is to parse the source code directly. An attacker would be far
> more likely to simply
i think variables also in the case of
PORT = 12345
Abdur-Rahmaan Janhangeer
https://github.com/Abdur-rahmaanJ
And it doesn't require that the end user have any knowlege of Python
> syntax or sematics.
>
--
https://mail.python.org/mailman/listinfo/python-list
lly installed (at least not on the
OSes I use).
> These days, "execute arbitrary code" implies a deliberate attack.
Perhaps I should have phrased it differently: I didn't mean to
restrict my comments to a deliberate attack.
> Now, if you used input validation as an argument,
with files provided by the
user.
Using configparser is far, far safer.
It seems a bit silly to me to worry about arbitrary code execution in
an interpreted language like Python whose default runtime execution
method is to parse the source code directly. An attacker would be far
more
configparser is far, far safer.
It seems a bit silly to me to worry about arbitrary code execution in
an interpreted language like Python whose default runtime execution
method is to parse the source code directly. An attacker would be far
more likely to simply modify the source to achieve
and that closes it,
thanks !!!
Abdur-Rahmaan Janhangeer
https://github.com/Abdur-rahmaanJ
Importing variables from a file is dangerous because it can execute
> arbitrary code. It should never be done with files provided by the
> user.
>
> Using configparser is far, far safer.
On 2018-06-27, Abdur-Rahmaan Janhangeer wrote:
> what is more recommended and why? using configparser for settings or import
> variables from file?
Importing variables from a file is dangerous because it can execute
arbitrary code. It should never be done with files provided by the
user.
what is more recommended and why? using configparser for settings or import
variables from file?
thanks,
Abdur-Rahmaan Janhangeer
https://github.com/Abdur-rahmaanJ
--
https://mail.python.org/mailman/listinfo/python-list
On 2017-02-21 00:04, Peter Otten wrote:
> Tim Chase wrote:
>> On 2017-02-20 10:45, Peter Otten wrote:
>>> value = parser.get("section-1", "option-1", fallback="default
>>> value")
>>
>> Huh. Do you remember when this was ad
remember writing my own wrappers multiple
> times for exactly these purposes, even to the point of opening an
> issue in the hopes of getting something of the like included
>
> https://lists.gt.net/python/bugs/827378?do=post_view_threaded
>
> So I'm glad to see it arrived; just
On 2017-02-20 10:45, Peter Otten wrote:
> value = parser.get("section-1", "option-1", fallback="default
> value")
Huh. Do you remember when this was added? I see it in the 3.x docs,
but not the 2.x docs. I remember writing my own wrappers multiple
times for exactly these purposes, even to the
On 02/20/2017 03:45 AM, Peter Otten wrote:
You can provide a default value in your code with
parser = configparser.ConfigParser()
parser.read(configfile)
value = parser.get("section-1", "option-1", fallback="default value")
Perfect. Thank you!
--
=
On 02/20/2017 01:39 AM, Ben Finney wrote:
I think you misinderstand the semantics of what ‘configparser’ expects
https://docs.python.org/3/library/configparser.html#configparser-objects>:
You are absolutely correct. Thank
Ian Pilcher wrote:
> I am trying to use ConfigParser for the first time (while also writing
> my first quasi-serious Python program). Assume that I want to parse a
> a configuration file of the following form:
>
>[section-1]
>option-1 = value1
>option-2 = valu
Ian Pilcher writes:
> How do a set a default for option-1 *only* in section-1?
I think you misinderstand the semantics of what ‘configparser’ expects
https://docs.python.org/3/library/configparser.html#configparser-objects>:
Default values […] are used in interpolation if an option u
I am trying to use ConfigParser for the first time (while also writing
my first quasi-serious Python program). Assume that I want to parse a
a configuration file of the following form:
[section-1]
option-1 = value1
option-2 = value2
[section-2]
option-1 = value3
option-2 = value4
for the typo.
> $ cat config.ini
> [Foo]
> secref: %(section)s/whatever
> [Bar]
> secref: %(section)s/whatever
> $ cat demo.py
> import configparser
>
>
> class Interpolation(configparser.BasicInterpolation):
> def before_get(self, parser, section, option, v
Hi,
> >
> > I run Ubuntu 16.04 LTS in a VM using VMWare Workstation on a Windows 10
> > host.
> > apt show python-configparser shows 3.3.0r2-2
> > On python 2.7.12 I use the following code:
> >
> > import configparser as cfg
> > root =
> > u
Christos Malliopoulos wrote:
> Hi,
>
> I run Ubuntu 16.04 LTS in a VM using VMWare Workstation on a Windows 10
> host.
> apt show python-configparser shows 3.3.0r2-2
> On python 2.7.12 I use the following code:
>
> import configparser as cfg
> root =
> u'/&
Hi,
I run Ubuntu 16.04 LTS in a VM using VMWare Workstation on a Windows 10
host.
apt show python-configparser shows 3.3.0r2-2
On python 2.7.12 I use the following code:
import configparser as cfg
root =
u'/'.join(os.path.split(os.path.abspath('cfg.py'))[0].split('/'
nybody, how to archive this with minimum fuzz?
If you can live with the existing "basic interpolation", i. e. %(...)s, not
%{...}s:
$ cat config.ini
[Foo]
secref: %(section)s/whatever
[Bar]
secref: %(section)s/whatever
$ cat demo.py
import configparser
class Interpolation(configp
Hi,
I would like to use a interpolated section name, e.g.:
[Section]
secref: %{section}s/whatever
should result in:
>>> config['Section']['secref']
'Section/whatever'
Any idea anybody, how to archive this with minimum fuzz?
Thanks,
Pete
--
https://mail.python.org/mailman/listinfo/python-list
t;)
>> 'a\nb'
>
> Interesting approach (although it does not work with Python 3: decode
> is only for byte-strings and the string-escape encoding is not
> defined).
The equivalent for Python 3 is
>>> import codecs
>>> codecs.decode("a\\nb&q
On Sun, Oct 2, 2016 at 9:34 PM, Thorsten Kampe
wrote:
>> If you want to have \n mean a newline in your config file, you can
>> do the conversion after you read the value:
>>
>> >>> "a\\nb".decode("string-escape")
>> 'a\nb'
>
> Interesting approach (although it does not work with Python 3:
* Ned Batchelder (Sat, 1 Oct 2016 17:41:28 -0700 (PDT))
>
> On Saturday, October 1, 2016 at 6:25:16 PM UTC-4, Thorsten Kampe wrote:
> > * Ben Finney (Sun, 02 Oct 2016 07:12:46 +1100)
> > >
> > > Thorsten Kampe writes:
> > >
> > > &
On Saturday, October 1, 2016 at 6:25:16 PM UTC-4, Thorsten Kampe wrote:
> * Ben Finney (Sun, 02 Oct 2016 07:12:46 +1100)
> >
> > Thorsten Kampe writes:
> >
> > > ConfigParser escapes `\n` in ini values as `\\n`.
>
> Indenting solves the problem. I'd ra
* Ben Finney (Sun, 02 Oct 2016 07:12:46 +1100)
>
> Thorsten Kampe writes:
>
> > ConfigParser escapes `\n` in ini values as `\\n`.
Indenting solves the problem. I'd rather keep it one line per value
but it solves the problem.
Thorsten
--
https://mail.python.org/mailman/listinfo/python-list
* Terry Reedy (Sat, 1 Oct 2016 15:44:39 -0400)
>
> On 10/1/2016 10:56 AM, Thorsten Kampe wrote:
>
> > ConfigParser escapes `\n` in ini values as `\\n`. Is there a way to
> > signal to ConfigParser that there is a line break?
>
> Without an example or two, I don'
Thorsten Kampe writes:
> ConfigParser escapes `\n` in ini values as `\\n`.
How do you demonstrate that?
Here is an example text of a config file::
>>> import io
>>> import textwrap
>>> config_text = textwrap.dedent(r"""
..
On 10/1/2016 10:56 AM, Thorsten Kampe wrote:
ConfigParser escapes `\n` in ini values as `\\n`. Is there a way to
signal to ConfigParser that there is a line break?
Without an example or two, I don't really understand the question enough
to answer.
--
Terry Jan Reedy
--
Hi,
ConfigParser escapes `\n` in ini values as `\\n`. Is there a way to
signal to ConfigParser that there is a line break?
Thorsten
--
https://mail.python.org/mailman/listinfo/python-list
On Thursday, November 12, 2015 at 10:48:11 AM UTC-5, John Zhao wrote:
> I have a configuration file with repeating sections, for example,
>
> [INSTANCE]
> Name=a
>
> [INSTANCE]
> Name=b
>
>
> I hope I can use ConfigParser to read the file and store the confi
On 2015-11-12 07:47, John Zhao wrote:
> I have a configuration file with repeating sections, for example,
>
> [INSTANCE]
> Name=a
>
> [INSTANCE]
> Name=b
>
> I hope I can use ConfigParser to read the file and store the
> configuration settings in arrays.
>
I have a configuration file with repeating sections, for example,
[INSTANCE]
Name=a
[INSTANCE]
Name=b
I hope I can use ConfigParser to read the file and store the configuration
settings in arrays.
Is that possible?
Thanks a lot.
John
--
https://mail.python.org/mailman/listinfo/python
On Friday, May 22, 2015 at 1:13:39 PM UTC-4, Ian wrote:
> On Fri, May 22, 2015 at 10:59 AM, gy wrote:
> > [python 2.7]
> > I need to use a configparser that is case-sensitive for option names, but
> > does not do magical interpolation of percent sign.
> > I.e.:
> &
On Fri, May 22, 2015 at 10:59 AM, wrote:
> [python 2.7]
> I need to use a configparser that is case-sensitive for option names, but
> does not do magical interpolation of percent sign.
> I.e.:
>
> [Mapping0]
> backupHost = eng%26
> dbNode = v_br_node0001
>
> sho
[python 2.7]
I need to use a configparser that is case-sensitive for option names, but does
not do magical interpolation of percent sign.
I.e.:
[Mapping0]
backupHost = eng%26
dbNode = v_br_node0001
should be read (and later written) as is, including capitalization and the
percent sign.
I
On 2013-11-25 18:29, Tim Chase wrote:
> On 2013-11-25 18:32, Rita wrote:
> > I was wondering if the default ConfigParser can handle multi line
> > strings (especially in the relate section)
> >
> > [Relate]
> > data="parent process A child process B
> &g
On 2013-11-25 18:32, Rita wrote:
> I was wondering if the default ConfigParser can handle multi line
> strings (especially in the relate section)
>
> [Relate]
> data="parent process A child process B
> Parent process B child process C
Yes, though I seem to recall that subs
Hi,
I was wondering if the default ConfigParser can handle multi line strings
(especially in the relate section)
For example, if i have system.ini
[Global]
memory = 1024
[Process A]
command = sleep
arguments = 100
[Process B]
command = nslookup
arguments = hostA
output = data
[Process C
On 2013-03-06, Chris Angelico wrote:
> On Wed, Mar 6, 2013 at 2:31 PM, Steven D'Aprano
> wrote:
>> What configuration settings does your podcast catcher software
>> need? What makes you think it needs any? Don't over-engineer
>> your application from the start. Begin with the simplest thing
>> tha
On Wed, Mar 6, 2013 at 3:54 PM, Steven D'Aprano
wrote:
> On Wed, 06 Mar 2013 15:19:53 +1100, Chris Angelico wrote:
>
>> On Wed, Mar 6, 2013 at 3:07 PM, Chuck wrote:
>>> I guess my question was more what is a config.file & why/how do I use
>>> one. Thanks
>>
>> In its simplest form, a config file
On Wed, 06 Mar 2013 15:19:53 +1100, Chris Angelico wrote:
> On Wed, Mar 6, 2013 at 3:07 PM, Chuck wrote:
>> I guess my question was more what is a config.file & why/how do I use
>> one. Thanks
>
> In its simplest form, a config file is one way to change a program's
> behaviour without editing th
On Wed, Mar 6, 2013 at 3:07 PM, Chuck wrote:
> I guess my question was more what is a config.file & why/how do I use one.
> Thanks
In its simplest form, a config file is one way to change a program's
behaviour without editing the code. They're helpful when you want to
be able to run the same prog
I guess my question was more what is a config.file & why/how do I use one.
Thanks
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, Mar 6, 2013 at 2:31 PM, Steven D'Aprano
wrote:
> What configuration settings does your podcast catcher software need? What
> makes you think it needs any? Don't over-engineer your application from
> the start. Begin with the simplest thing that works, and go from there.
Agreed. The way I
On Tue, 05 Mar 2013 18:15:20 -0600, Tim Chase wrote:
> On 2013-03-05 15:58, Chuck wrote:
>> Thanks Tim! So much stuff I haven't thought of before. Out of
>> curiosity, what's the benefit of caching the download, instead of
>> downloading to the final destination?
>
> If your connection gets in
On Tue, 05 Mar 2013 12:09:38 -0800, Chuck wrote:
> I'm curious about using configuration files. Can someone tell me how
> they are used? I'm writing a podcast catcher and would like to set up
> some default configurations, e.g. directory, etcOther than default
> directory, what are some of
On 2013-03-05 15:58, Chuck wrote:
> Thanks Tim! So much stuff I haven't thought of before. Out of
> curiosity, what's the benefit of caching the download, instead of
> downloading to the final destination?
If your connection gets interrupted, the server goes down, etc, you
have a partial downl
Thanks Tim! So much stuff I haven't thought of before. Out of curiosity,
what's the benefit of caching the download, instead of downloading to the
final destination? So much stuff they never teach you school.So much
theory & not enough practice. :(
--
http://mail.python.org/mailman/l
On 2013-03-05 12:09, Chuck wrote:
> I'm curious about using configuration files. Can someone tell me
> how they are used? I'm writing a podcast catcher and would like
> to set up some default configurations, e.g. directory, etcOther
> than default directory, what are some of the things that
I'm curious about using configuration files. Can someone tell me how they are
used? I'm writing a podcast catcher and would like to set up some default
configurations, e.g. directory, etcOther than default directory, what are
some of the things that are put in a configuration file? They
On Friday, October 5, 2012 5:03:01 PM UTC+5:30, Günther Dietrich wrote:
> justmailha...@gmail.com wrote:
>
>
>
> >How to read properties file in Python? I found ConfigParser() but it has a
>
> >'section' limitation, so looking for other alternati
justmailha...@gmail.com wrote:
>How to read properties file in Python? I found ConfigParser() but it has a
>'section' limitation, so looking for other alternatives.
Have a look at PyYAML.
Best regards,
Günther
--
http://mail.python.org/mailman/listinfo/python-list
On 2012-10-05 09:20, justmailha...@gmail.com wrote:
Hi All,
How to read properties file in Python? I found ConfigParser() but it has a
'section' limitation, so looking for other alternatives.
http://wiki.python.org/moin/ConfigParserShootout
--
http://mail.python.org/mailman/listi
Hi All,
How to read properties file in Python? I found ConfigParser() but it has a
'section' limitation, so looking for other alternatives.
Thanks,
Harsh
--
http://mail.python.org/mailman/listinfo/python-list
>> with one minor difference.
> | >>
> | >> The write() mehtod should keep existing comments.
> | >
> | > Assuming that you have not overlooked anything, I would just subclass
> | > ConfigParser with an altered write method.
> |
> | It would require a lot
Le 15/03/2012 03:48, Steven W. Orr a écrit :
On 3/14/2012 6:07 AM, Gelonida N wrote:
Hi,
At the moment I use ConfigParser
http://docs.python.org/library/configparser.html
for one of my applications.
Now I'm looking for a library, which behaves like config parser, but
with one
od should keep existing comments.
| >
| > Assuming that you have not overlooked anything, I would just subclass
| > ConfigParser with an altered write method.
|
| It would require a lot more than that. It would entail changing
| the reading as well so that it preserved the comments as well as
| t
On 3/14/2012 6:07 AM, Gelonida N wrote:
Hi,
At the moment I use ConfigParser
http://docs.python.org/library/configparser.html
for one of my applications.
Now I'm looking for a library, which behaves like config parser, but
with one minor difference.
The write() mehtod should keep exi
just subclass
ConfigParser with an altered write method.
It would require a lot more than that. It would entail changing
the reading as well so that it preserved the comments as well as
the order of sections & keys, and a way of storing those
associated comments in sequence. I looked into it a f
On 3/14/2012 6:07 AM, Gelonida N wrote:
Hi,
At the moment I use ConfigParser
http://docs.python.org/library/configparser.html
for one of my applications.
Now I'm looking for a library, which behaves like config parser, but
with one minor difference.
The write() mehtod should keep exi
Hi,
At the moment I use ConfigParser
http://docs.python.org/library/configparser.html
for one of my applications.
Now I'm looking for a library, which behaves like config parser, but
with one minor difference.
The write() mehtod should keep existing comments.
Does anybody know or impl
On May 2, 3:25 pm, Chris Rebert wrote:
> On Mon, May 2, 2011 at 3:04 PM, Unknown Moss wrote:
> > Hi -Beginnerquestionhere. I'm working with ConfigParser. I'd like
> > to take a multiline variable and convert it directly to an array.
> > Seems like a common proble
On Mon, May 2, 2011 at 3:04 PM, Unknown Moss wrote:
> Hi - Beginner question here. I'm working with ConfigParser. I'd like
> to take a multiline variable and convert it directly to an array.
> Seems like a common problem, but I don't see how I can do it without
> doing
Hi - Beginner question here. I'm working with ConfigParser. I'd like
to take a multiline variable and convert it directly to an array.
Seems like a common problem, but I don't see how I can do it without
doing a little parsing in my own code. Here's what I'm doing ...
On Dec 8, 10:32 am, RedBaron wrote:
> Is there any way by which configParser's get() function can be made
> case insensitive?
I would probably subclass dict to create a string specific, case
insensitive version, and supply it as the dict_type. See
http://docs.python.org/library/configparser.html#
On 8 Dic, 11:32, RedBaron wrote:
> Is there any way by which configParser's get() function can be made
> case insensitive?
If you don't care about the case of the config parameter values, you
could pre-convert the input to
configParser all in UPPER or lower letter with a file-
Is there any way by which configParser's get() function can be made
case insensitive?
--
http://mail.python.org/mailman/listinfo/python-list
import ConfigParser
# New instance with 'bar' and 'baz' defaulting to 'Life' and 'hard' each
config = ConfigParser.SafeConfigParser({'bar': 'Life', 'baz': 'hard'})
config.read('example.cfg')
print
How about doing something like
host.name=%HOSTNAME%
Then when you parse in the value %HOSTNAME% from your configParser module you
do a pattern substitution of %HOSTNAME% with os.environ['HOSTNAME'].
Sent from my iPhone 4.
On Oct 14, 2010, at 7:57 PM, pikespeak wrote:
> Hi,
Hi,
I am using ConfigParser module and would like to know if it has the
feature to autoexpand environment variables.
For example currently, I have the below section in config where
hostname is hardcoded.
I would like it to be replaced with the values from the env variable
os.envion['HOSTNAME
On Sep 23, 2010, at 1:22 PM, Andrew Z. wrote:
> Is there a way to parse RealPlayer's realplayerrc in Python? I need
> to support Python 2.5 - 2.7
>
> Example code
>
> import urllib2
> import ConfigParser
> f = urllib2.urlopen('http://pastebin.com/
Is there a way to parse RealPlayer's realplayerrc in Python? I need
to support Python 2.5 - 2.7
Example code
import urllib2
import ConfigParser
f = urllib2.urlopen('http://pastebin.com/download.php?i=N1AcUg3w')
config = ConfigParser.RawConfigParser()
config.readfp(f)
Error
1 - 100 of 246 matches
Mail list logo