[Tutor] where to put configuration files

Sean 'Shaleh' Perry shalehperry@attbi.com
Tue Jun 10 00:18:02 2003


>
> Sorry to be dense, but could you give me an example of using the
> __file__ attribute? This would really sovle a lot of the problem. Most
> applications (at least unix), have a .config file in the home directory.
> (For example, .vimrc for vim.)
>
> The user will actually want to have easy access to the configuration
> file. The directory /etc is for scary things like sendmail!
>
> Thanks
>
> Paul

one of the joys of python is being able to start the interpreter and 
experiment.

>>> import glob
>>> dir(glob)
['__all__', '__builtins__', '__doc__', '__file__', '__name__', 'fnmatch', 
'glob', 'glob1', 'has_magic', 'magic_check', 'os', 're']
>>> type(glob)
<type 'module'>
>>> type(glob.__file__)
<type 'str'>
>>> glob.__file__
'/usr/lib/python2.2/glob.pyc'
>>> glob.glob("*.cc") # I was in a dir with some of my C++ code
['Workspace.cc', 'Clientmenu.cc', 'Configmenu.cc', 'Iconmenu.cc', 
'Rootmenu.cc', 'Screen.cc', 'Slit.cc', 'Toolbar.cc', 'Window.cc', 
'Windowmenu.cc', 'Workspacemenu.cc', 'blackbox.cc', 'main.cc', 
'BlackboxResource.cc']