ioam / topographica

A general-purpose neural simulator focusing on topographic maps.
topographica.org
BSD 3-Clause "New" or "Revised" License
53 stars 32 forks source link

Consider handling "~" in parameter path functions? #474

Open sf-issues opened 12 years ago

sf-issues commented 12 years ago

Converted from SourceForge issue 3477666, submitted by ceball Submit Date: 2012-01-23 10:48 GMT

I was surprised to find that param.resolve_path() doesn't work with "~" on linux:

[cortex]v1cball: touch ~/testing123 [cortex]v1cball: python Python 2.6.6 (r266:84292, May 20 2011, 16:42:11) [GCC 4.4.5 20110214 (Red Hat 4.4.5-6)] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import param param.resolve_path("~/testing123") Traceback (most recent call last): File "", line 1, in File "param/parameterized.py", line 1789, in new return inst.call(*args,**params) File "param/init.py", line 898, in call raise IOError(os.path.split(path)[1] + " was not found in the following place(s): " + str(paths_tried) + ".") IOError: testing123 was not found in the following place(s): ['/disk/scratch/s0454615/topographica-dice/~/testing123'].

Maybe that's ok, I'm not sure. Feel free to close this.

Python has os.path.expanduser() to deal with "~":

import os.path param.resolve_path(os.path.expanduser("~/testing123")) '/afs/inf.ed.ac.uk/user/v/v1cball/testing123'

sf-issues commented 12 years ago

Submitted by jbednar Date: 2012-01-25 11:31 GMT

I think we should pass things through expanduser in resolve_path.