On Mon, 04 Apr 2005 17:02:20 -0400, Brian van den Broek wrote:
Jeremy suggested using a directory name akin to "C:\onlyanidiotwouldhavethisdirecotrynameonadrive". That is what I had settled on before I posted. Somehow it feels unhappy and inelegant. But, I'm a bit less uncomfortable with it seeing that others have done so, too.
To be clear, I would actually suggest "onlyanidiotwouldhavethisdirecotrynameonadrive"... note the lack of C:\,
Quite so. My apologies for mis-characterizing your suggestion. And thanks for the additional information that mis-characterization provoked :-)
Best,
Brian vdB
which would be platform specific, as would any other root specification.
Take advantage of the fact that every system I know of makes relative
directories easy, and also note you can work out what directory the
"current file" is in with a combination of __file__ and os.getcwd() (and
that while that won't work if someone changes the working directory,
that's bad form and IIRC breaks some other things in Python as well, so
don't do that).
Making it a relative directory may make it look just as bad, but it is in some sense somewhat less inelegant; at that point, if someone is creating that directory in the test directory of your app, they're just fooling with you, and you don't really have to worry about people who maliciously make your unit tests fail under most circumstances... :-)
-- http://mail.python.org/mailman/listinfo/python-list