Path to user directory without username

except what Mitch is saying is that doesn’t work… if you put ~/desktop in a rhino alias, rhino doesn’t know what or where ~/ is… i’d have to type Users/jeff/Desktop… you’d have to put Users/AIW/Desktop… and mitch would be Users/Helvetosaur/Desktop

we can’t all three use ~/Desktop

mitch’s question is asking what can all three of us type, exactly the same, and the path leads to our respective/individual desktops…


in terminal, we could all three use ~/Desktop
in python, it’d have to be os.path.expanduser("~/Desktop")
in rhino alias-- what do you type? mitch (nor i) can figure it out if it’s even possible to begin with.

You’re not being thick. This is not a user friendly hack that will hopefully do what you need for now.
In a near future release of Rhino the Python path will be configurable.

For your last example:

!-_RunPythonScript "./junk/junkscript.py"

and

!-_RunPythonScript "junk/junkscript.py"

should both work because the ~/Library/Application Support/McNeel/Rhinoceros/scripts path will be searched.

hth
Alain

hey that works!
:smile:

(as long as the folder is somewhere after the Scripts folder… but still. helpful)

My bad. I forgot that Windows didn’t implement it. I guess that in this day and age I expect this kind of stuff to be universal.

I still think the main hiccup will be overcoming access permissions when one user tries to use something in another user’s path.

This is not a real problem as Windows Rhino offers several ways of getting scripts to users, including custom toolbars and plug-ins, as well as being able to easily specify search paths to a specific folder. Mac Rhino does not have any of that yet unfortunately.

–Mitch

So, finally getting back to this after a summer full of other work… Thanks @Alain, this seems to be working correctly now! I’m almost done here, 75 tools ready to distribute, just need to do a bit more testing and then put it on a web page somewhere.

Quick minor question, if I don’t have any spaces in my python filenames, will something like !-_RunPythonScript ./junk/junkscript.py (without enclosing the path in quotes) be reliable? Seems to work here, it’s just a detail that will make it easier for me to get the paths to a text file automatically out of Excel. If not, I’ll figure out a way to get them in there.

Many thanks, --Mitch

Hey Mitch,

I prefer to keep the quotes just in case but it should be ok.

Alain

Hello,

Are they any way to make scripts recognize the windows user variables ?

Something like:
!-_RunPythonScript “%AppData%\McNeel\Rhinoceros\7.0\Plug-ins\PythonPlugins\myplugin\myscript.py”

would be ideal

Hi @gaspard.bourgeois,

I’ve logged your request.

https://mcneel.myjetbrains.com/youtrack/issue/RH-65032

– Dale

1 Like