I need to edit the value(s) of a config file via a GUI interface. I'm
trying to use ConfigParser but set() doesn't seem to write.
Here are my reading and writing functions
def getConfig(self, value=None):
config = ConfigParser.Co nfigParser()
config.readfp(o pen('config.inf '))
return config.defaults ()[value]
def setConfig(self, option, value):
config = ConfigParser.Co nfigParser()
config.readfp(o pen('config.inf ', 'a'))
config.set("DEF AULT", option, value)
The values are getting passed ok it just won't set the value to the
new value i have selected.
can anyone offer any hints? 1 2257
Mike Zupan wrote: I need to edit the value(s) of a config file via a GUI interface. I'm trying to use ConfigParser but set() doesn't seem to write.
Here are my reading and writing functions
def getConfig(self, value=None): config = ConfigParser.Co nfigParser() config.readfp(o pen('config.inf ')) return config.defaults ()[value]
def setConfig(self, option, value): config = ConfigParser.Co nfigParser() config.readfp(o pen('config.inf ', 'a')) config.set("DEF AULT", option, value)
The values are getting passed ok it just won't set the value to the new value i have selected.
can anyone offer any hints?
Maybe you're simply missing a config.write('c onfig.inf')?
Mathias This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: tom |
last post by:
hello all,
i have a web application that i want users to be able to
change the name of the server and database from a web page.
i have got this to work using this...
code:-
|
by: Stuart Ferguson |
last post by:
I am attempting to put a screen in a web application that allows editing
of AppSettings values in the Web.Config file using the Web Configuration
manager class however on he .Save i get an access denied exception.
What could be causing this exception and what should i be looking at to
fix the problem.
Many Thanks
Stuart
|
by: Agnes |
last post by:
In my application, there is an hard code string ,to connect the database.
Can I use config file instead of it ?? Please Help & Thx.
Public Shared CONNECTION_STR_ACCOUNT As String = "workstation
id=AGNES;packet size=4096;user id=sa;data source='hlssql';persist security
info=True;initial
catalog=dts_account;password='sys+em'"
|
by: Alan Silver |
last post by:
Hello,
I have a need to read the web.config file from another web site. I am
trying get the value of the "theme" attribute of the "pages" node.
I initially tried to do this by loading the file into an XmlDocument and
using SelectSingleNode with a path like
"/configuration/system.web/pages", but no matter what variation of the
path I tried, this gave a null object.
|
by: John |
last post by:
Hi,
Trying to troubleshoot a web app. I'm getting the usual "set your
web.config file to customErrors mode="Off"" message.
Anyway, I DO have a web.config file in the root of the app, but it's not
reading it because i DO have customErrors mode=Off
Why won't it use this file!?
Thanks
| |
by: hazz |
last post by:
With this code, the config file(listed below) opens initially into the
datagrid display with only a plus sign '+'.
On clicking that, it becomes expanded to;
-
appsettings
add
When I click on appsettings, it reverts back to '+' On clicking that,
- appsettings add is displayed
Finally, when I click on appsettings this time, the contents of the config
|
by: Ryan |
last post by:
I am trying to log events to SQL Server instead of the computers event
log, but, although I get no errors, I have no luck. The
webevents_events table is empty. I have a custom event that I am
raising (passwordchange), and can see it beign raised
successfully...just it seems to go nowhere. I have run aspnet_regsql
to setup the database to handle event recording. I am fairly sure I am
missing something in my web.config file. (I would...
|
by: Blasting Cap |
last post by:
I am working on a web app that I want to be able to use a separate
config file on, in addition to the web.config file that's already
working in the application.
If I put the following in the web.config file (VS 2005, Framework 2.0),
I can retrieve the values fine:
<appSettings>
<add key="fileInputFolder" value="C:\National City Downloads\test"/>
<add key="fileTransaction" value="\Transactions\"/>
|
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 file was built by draging tables from the Data Sources pane.
Auto-generated code created the files associated wtih the XSD file (xss,
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |