ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> pythoncard
pythoncard
[Pythoncard-users] added homedir config support
by Kevin Altis other posts by this author
Jan 12 2003 11:35PM messages near this date
[Pythoncard-users] Can't save from Resource Editor.. | Re: [Pythoncard-users] flatfileDatabase and XML
I've added rudimentary config directory support to PythonCard with the
'homedir' variable in module config.py. This should really help with Unix
installations where previously the package dir and its sub-directories were
not writeable unless you ran PythonCard as root, thus causing exceptions
whenever a config file write attempt was made. As an added bonus, as new
versions of PythonCard are released, you won't lose your config info either.

The main code is in the config.py module. The idea is to create a
".pythoncard" directory where all the PythonCard config information can be
stored; each user has their own config dir. This directory is then the base
for any samples or tools that want to store changing config or data files in
a standard place. The directory that is used depends on what environment
variables the user has set:

Unix and Windows if HOME environment variable is set
os.environ['HOME']

Windows
os.environ['USERPROFILE']

which results in...
On Windows 2000: \Documents and Settings\%UserName%
On Windows NT 4.0: \Winnt\Profiles\%UserName%
On Windows 98: \Windows\Profiles\%UserName%
On Windows Me: \Windows\Profiles\%UserName%
On Windows 2000 after upgrading from Windows NT 4.0:
\Winnt\Profiles\%UserName%


fallback
__file__ attribute of the config.py module.

It is likely that if we make it to the point of using the __file__ attribute
that the directory won't be writeable and that the problems of trying to
write config files will occur in this situation as well. I will not be doing
any real testing of this situation before release 0.7. I also won't be
adding any optional command-line args this release to allow a user to
override the config dir used, though that will probably be needed later for
debugging.

I plan to make sure all the config files conform the .ini format, but for
now I've just left the formats basically the same to reduce the possibility
of introducing other errors with this base directory change.

All of the tools in cvs now use the .pythoncard configuration directory and
by sometime tomorrow all the samples that use a config file or data file
that changes will also be updated to use the .pythoncard directory.

When PythonCard starts up it will attempt to create the dir and copy the
pythoncard_config.txt and stc-styles.rc.cfg files if they don't already
exist.

Please report any problems ASAP.

ka



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Pythoncard-users mailing list
Pythoncard-users@[...].net
https://lists.sourceforge.net/lists/listinfo/pythoncard-users

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved