Problem With py2exe and ConfigParser

Diez B. Roggisch deets at nospam.web.de
Sun Feb 1 11:39:29 EST 2009


berserker992 at gmail.com schrieb:
> Hello, i use python 2.6 + PyQt4.
> I compile my main.pyw. It is compile, but don't run. In
> "index.exe.log" error log:
> 
>>>>  File "index.pyw", line 100, in GetVal
>>>> ConfigParser.NoSectionError: No section: 'Main'
> 
> 
> 
> 
>>>> Code line 92 to 104 this is class that uses ConfigParser lib:
>>>> class ConfigAcces:
>>>>    def __init__(self):
>>>>        self.cnf = ConfigParser()
>>>>    def GetLibUrl(self):
>>>>        self.cnf.read("config.ini")
>>>>        return self.cnf.get("Main","lib_path")
>>>>    def GetVal(self, p, key):
>>>>        self.cnf.read("config.ini")
>>>>        return self.cnf.get(p,key)
>>>>    def SetVal(self, selection, option, NewVal):
>>>>        self.cnf.read("config.ini")
>>>>        self.cnf.set(selection,option,NewVal)
>>>>        self.cnf.write(open("config.ini", "w"))
> 
> 
> 
> how do I fix this?


By passing the right path for the configuration file? It's obviously not 
found.

Diez



More information about the Python-list mailing list