|
From: Alex H. <me...@gm...> - 2010-01-18 03:46:01
|
Hello all,
I am new to this list. I am writing a small application (so small it is
really just a single script and an ini file). I am trying to read my ini
file. This was working earlier today, but I put the initial reading in a try
statement and now nothing works!! Does anyone see anything wrong with the
below syntax? Note that indents are one space, not four.
iniLoc=os.path.dirname(sys.argv[0])+"\\arm.ini"
try:
ini=ConfigObj('c:\arm\arm.ini', interpolation=False, fileerror=True)
except:
print("The ARM.ini file was not found or could not be accessed. Please make
sure no other program is using the file, and that the file "+iniLoc+"
exists, and try running ARM again.")
exitProgram()
#end except
The program is called ARM, and the ini file is currently at c:\arm\arm.ini.
However, the file cannot be found whether I use the iniLoc variable or
hard-code the location, as I did in the above code.
Also, I found a tutorial earlier today that got me started, but the syntax
in that tutorial was
file=ConfigObj(r"c:\...")
Note the "r" in front of the path. My program did not work right until I put
in the "r", but now it seems to make no difference. I cannot imagine what
this "r" is supposed to do, and I cannot find it in the documentation. Any
light shed on this would be great. Thanks!
Have a great day,
Alex
Email: me...@gm...
|