i think ~/ is a unix thing?
python (& apparently rhino aliases) don’t have automatic path expansion and it needs to be explicitly called when desiring shell-like path exapansion.
but with rhino only, i can’t figure a way to do what you’re trying to do… (make a macro
-RunPythonScript "~/Desktop/test.py" )
i’m not sure what the final goal of yours is but it sounds like you’re tyring to distribute a script to people which can be called via an alias. ?
which got me to thinking you could make a python script to ‘install’ and assign an alias. (maybe)… the only caveat is the user would need to run the installer script from within rhino using runPythonScript…
• run the script
• it asks where the desired script is…
rs.OpenFileName() (it’s probably in the user’s download folder so maybe make that the default location when the dialog comes up)
• ask for the desired
• do what alain was showing to get relative install location…
path = os.path.expanduser("~/Library/Application Support/McNeel/Rhinoceros/junkfolder")
• copy the .py from the downloads folder to
path … shutil.copy(file, path) ?
• assign the alias name in rhino
rs.AddAlias(alias, "-RunPythonScript " + path)
so that’s possibly way off topic but something the maybe mess around with one day plus, (if it works like i think) it’s an example of the hoop jumping that might have to happen in order to use a relative path in a rhino alias.
(the actual alias in rhino would show the user name in it instead of ~ …but python can find out what the desired path is using ~ )