Making code run in both source tree and installation path

Robert Kern robert.kern at
Wed Jul 1 18:17:31 CEST 2009

On 2009-07-01 01:04, Carl Banks wrote:
> On Jun 29, 9:20 am, Javier Collado<javier.coll... at>  wrote:
>> I've seen different approaches:
>> - distutils trick in to modify the installed script (i.e.
>> changing a global variable value) so that it has a reference to the
>> data files location.
> One of my biggest complaints about distutils is that it doesn't do
> this, a limitation made worse by the fact that distutils allows you to
> specify an alternate data file directory, but your scripts have no way
> to know what that alternate directory is installed.  Which really
> limits the usefulness of that functionality.
> The most common way I've seen people work around this issue is to
> throw their data files into the package directories.  Yuck.

Huh. I always found that to be a more elegant solution than hardcoding the data 
location into the program at install-time.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

More information about the Python-list mailing list