[IPython-user]: IPython install under Win2000

Alan G Isaac aisaac at american.edu
Mon Jul 18 18:36:48 CDT 2005


On Mon, 18 Jul 2005, Fernando Perez apparently wrote: 
> Unless someone complains soon, this will go into SVN later today 

Well my only "complaint" is that you do not start by trying
os.path.expanduser("~")
which I took from the discussion to be supported on Un*x,
many Windows, and Mac OSX.  So I expected the core routine
to be something like below.  I admit to being very new to
these considerations however.  Additionally, your proposed
path seems to fully address my problem---thanks!

Alan Isaac


def getHomeDir():
	'''
	see http://mail.python.org/pipermail/python-list/2005-February/263921.html
	Find user's home directory if possible, otherwise return None.
	'''
	path=''
	try:
		path=os.path.expanduser("~")
	except:
		pass
	if not os.path.isdir(path):
		for evar in ('HOME', 'USERPROFILE', 'TMP'):
			try:
				path = os.environ[evar]
				if os.path.isdir(path):
					break
			except: pass
	if path: return path
	else: return None




More information about the IPython-user mailing list