On Tuesday, March 15, 2011 9:47:17 AM UTC-4, Mario Rol wrote:
> 
> os.path.join(sys.path[0], 'config.txt')
> 
> If the script and config.txt are in /tmp this will return '/tmp/
> config.txt' no matter from which directory you started the script.

You have to be careful about symlinks. Even Windows has support for symlinks, 
since version 6, via mklink (jaraco.windows can monkeypatch os.readlink to 
support NTFS symlinks). 

Maybe it would be better to use setuptools, which will also work for eggs and 
zip files that don't use __file__: 

http://packages.python.org/distribute/setuptools.html

Included data files are accessible via 'pkg_resources', and the installer can 
deploy 'console_scripts' and 'gui_scripts' as 'entry_points' in locations 
specific to each supported platform.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to