473,378 Members | 1,066 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Configfile

***********************
Your mail has been scanned by InterScan MSS.
***********************
HI,

I've a small doubt regarding the way to save a configuration file on the file
manipulated by ConfigParser.
As far as I could understand this:

cp = ConfigParser.ConfigParser
cp.set(section,option)

will it do the set on the file or do I have to issue a "cp.write(fp)" in order
to get it done?
My tests didn't resulted positively.

F
Oct 27 '06 #1
3 1133
Fulvio schrieb:
***********************
Your mail has been scanned by InterScan MSS.
***********************
HI,

I've a small doubt regarding the way to save a configuration file on the file
manipulated by ConfigParser.
As far as I could understand this:

cp = ConfigParser.ConfigParser
You are missing a () here....
cp.set(section,option)

will it do the set on the file or do I have to issue a "cp.write(fp)" in order
to get it done?
My tests didn't resulted positively.
What does that mean? Did your head explode, has a giant mammoth stomped
your PC into oblivion, or has by any chance an exception occured that
you don't show us?

I guess you've been told to read this here, but just in case it wasn't,
or you didn't bother to read it:

http://catb.org/esr/faqs/smart-questions.html

Diez
Oct 27 '06 #2
Fulvio wrote:
***********************
Your mail has been scanned by InterScan MSS.
***********************
HI,

I've a small doubt regarding the way to save a configuration file on the file
manipulated by ConfigParser.
As far as I could understand this:

cp = ConfigParser.ConfigParser
cp.set(section,option)

will it do the set on the file or do I have to issue a "cp.write(fp)" in order
to get it done?
My tests didn't resulted positively.

F

Yes you have to get a file pointer (fp) and do the write as you noted.

Also to get instance of ConfigParser you need:

cp = ConfigParser.ConfigParser() (note the trailing parenthesis)

If you want to read existing .INI file before doing this you need a
cp.read('filename.ini') somewhere in your code.

-Larry
Oct 27 '06 #3
Fulvio wrote:
***********************
Your mail has been scanned by InterScan MSS.
***********************
HI,

I've a small doubt regarding the way to save a configuration file on the file
manipulated by ConfigParser.
As far as I could understand this:

cp = ConfigParser.ConfigParser
cp.set(section,option)

will it do the set on the file or do I have to issue a "cp.write(fp)" in order
to get it done?
My tests didn't resulted positively.

F

Yes you have to get a file pointer (fp) and do the write as you noted.

Also to get instance of ConfigParser you need:

cp = ConfigParser.ConfigParser() (note the trailing parenthesis)

If you want to read existing .INI file before doing this you need a
cp.read('filename.ini') somewhere in your code.

-Larry
Oct 27 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Aidan | last post by:
Hey there, I've written a script that calls AWStats to generate static statistics pages for a given site on a certain month, and place those files into a directory for that month... It has been...
4
by: Dan Rawson | last post by:
Is there any way to force getopt to process one option first?? I'd like to be able to pass in the name of a configuration file for my application, then have the remaining command-line parameters...
0
by: Joan Bos | last post by:
Hi, Is there somewhere on the Internet a description of what a .NET application config file should contain? For our application, I have to write passwords encrypted in a config file. The...
24
by: Dan Bass | last post by:
I know that XslTransform's Transform is thread safe according to the MSDN, and that Load is not. I've therefore applied this simply Mutex to it and would just like to confirm this is okay. ...
4
by: Greg Scharlemann | last post by:
I thought I had a workable approach to specifing which pages required a redirect in a config file, but it appears the way I'm attempting to do it is not going to work. The idea is that I can...
3
by: moonstonelane | last post by:
Hi all, I just picked up XML and trying to figure out on CSharp. Would like some pointers here. E.g of my XML file <configfile avi-in-btw="1" gif-in-btw="1"> <keyframecount num="2">...
4
by: apriebe47 | last post by:
Alright, I realize this is probably very basic to be posted on this newsgroup but I cannot figure out what is causing my problem. Here is the code I am using below: from getpass import getpass ...
7
by: Gillykumar | last post by:
Hi, I would like use two perl file one for execution and one for config. I want to confi the path in the config file and use it in the executing the Perl. How to access the variable from the other...
12
by: dbuchanan | last post by:
Hello, (Is this the proper newsgroup?) === Background === I am building a solution with two projects. One project is my data access layer which contains my DataSet as an xsd file. The XSD...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.