Bug in scipy.weave.catalog.default_dir()

I am using scipy.weave in an environment in which my home directory is not accessable. However, scipy.weave attempts to write to $HOME/.python25_compiled, even though I set PYTHONCOMPILED. Looking a little deeper, I see that scipy.weave.catalog.default_dir() is implemented incorrectly. The documentation says: "If for some reason it isn't possible to build a default directory in the user's home, /tmp/<uid>_pythonXX_compiled is used." What actually happens is that if $HOME is defined, $HOME/.python25_compiled is used and no exception is caught if writing fails. I would prefer that, as per the documentation, if $HOME/.python25_compiled is not writeable then the exception is caught and /tmp/<uid>_pythonXX_compiled is used instead. Could someone please implement this? It's a simple fix. Thanks, Joseph -- Academic: http://www-etud.iro.umontreal.ca/~turian/ Business: http://www.metaoptimize.com/

Hi Joseph 2008/10/8 Joseph Turian <turian@gmail.com>:
I am using scipy.weave in an environment in which my home directory is not accessable. However, scipy.weave attempts to write to $HOME/.python25_compiled, even though I set PYTHONCOMPILED.
Looking a little deeper, I see that scipy.weave.catalog.default_dir() is implemented incorrectly. The documentation says: "If for some reason it isn't possible to build a default directory in the user's home, /tmp/<uid>_pythonXX_compiled is used."
What actually happens is that if $HOME is defined, $HOME/.python25_compiled is used and no exception is caught if writing fails. I would prefer that, as per the documentation, if $HOME/.python25_compiled is not writeable then the exception is caught and /tmp/<uid>_pythonXX_compiled is used instead.
This should now be fixed. Regards Stéfan

Stéfan van der Walt wrote:
Hi Joseph
2008/10/8 Joseph Turian <turian@gmail.com>:
I am using scipy.weave in an environment in which my home directory is not accessable. However, scipy.weave attempts to write to $HOME/.python25_compiled, even though I set PYTHONCOMPILED.
Looking a little deeper, I see that scipy.weave.catalog.default_dir() is implemented incorrectly. The documentation says: "If for some reason it isn't possible to build a default directory in the user's home, /tmp/<uid>_pythonXX_compiled is used."
What actually happens is that if $HOME is defined, $HOME/.python25_compiled is used and no exception is caught if writing fails. I would prefer that, as per the documentation, if $HOME/.python25_compiled is not writeable then the exception is caught and /tmp/<uid>_pythonXX_compiled is used instead.
This should now be fixed.
Should this change also be done on the 0.7.x branch? Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma

Hey Ryan It's not a particularly serious problem, and should only occur if you have an existing .python25_compiled directory in ${HOME} that is not writable any longer. Also, it isn't easy to write a unit test for this specific case, so I'd feel safer if more people would try it out before it propagates too far. Cheers Stéfan 2009/1/7 Ryan May <rmay31@gmail.com>:
Stéfan van der Walt wrote:
Hi Joseph
2008/10/8 Joseph Turian <turian@gmail.com>:
I am using scipy.weave in an environment in which my home directory is not accessable. However, scipy.weave attempts to write to $HOME/.python25_compiled, even though I set PYTHONCOMPILED.
participants (3)
-
Joseph Turian
-
Ryan May
-
Stéfan van der Walt