I am having a difficulty about running my existing scripts… I touched on this before and McNeel team was do nice to promise me a forwarding of the old ‘RunPythonScript’ command to the ‘ScriptEditor’ command. As of the latest BETA I haven’t seen any difference. I can wait a little more, that’s not a problem but the problem I face has something to do related to this.
When I run my scripts the new way (using ‘-ScriptEditor Run’ way) I still cannot get it to work because now the code expects me to feed the real path to the python script that I want to run. Like in the following example (I have a script called LayerOnOff.py):
Command: -_ScriptEditor
Select Option ( Edit Run Open Test ): _Run
Path of script to run ( Browse ): LayerOnOff.py
File LayerOnOff.py not found, unable to open
Input string is not formatted as script source or file path
I have tens of macros and aliases like this. I don’t want to change them all by hand for 2 reasons. First, it is too much work. Secondly, if I format my PC or work on someone else’s PC I would have to change the paths again.
Why can’t the ScriptEditor search the given script file name (in this case LayerOnOff.py) in the folders given in the ScriptEditor > Tools > Options > Python3 > Module Search Paths? This was working smoothly within the old RunScriptEditor command.
Can the code rearranged so that it searches automatically in the given folders for ease of use?
The list that -ScriptEditor Run checks for a bare name is Options > Files > Search Paths, not the Python module search paths in the editor. Add your script folder there and the name-only macros should work, and since March the same goes for -RunPythonScript (RH-54696). i added a wish to also honor the module search paths, RH-99449
Putting my folder into the search paths in helped solving the full path issue.
Shall I wait a little bit more for the ‘RunPythonScript’ command being directed to ‘EditPythonScript Run’ workflow? I honestly dread changing all of the aliases that include ‘RunPythonScript’ into ‘ScriptEditor Run’ manually…
@Erdem This is the current set up. Would you mind give me a bit more context as to why you’d want the module search paths to be used both for module search and script search?
Thanks for asking. Here is a macro that I have written. It worked like charm on R7 and R8. That’s why I kept on writing these type of macros.
_NoEcho
-_RunPythonScript
ChangeObjectLayer.py
7
What this macro does is runs the py file and provides the layer order of the desired layer to change the layer of the selected objects. This works much faster than going to the layer tab, finding the desired layer, right clicking to open the menu and selecting ‘change object layer’. I am in front of Rhino 8 hours a day and such things save me a lot of time, as you may understand.
I understand the current setup that you mention but that means I need to change 60-70 macros from ‘RunPythonScript’ to ‘ScriptEditor Run’ manually. I am sure there are a lot of others in my situation. We would have to invest a lot of time doing this change including all users.
I just want these aliases to work on the BETA. They are not working as of now. This is my problem. I welcome the new features but it would be awesome if they were backwards compatible.
In the meantime I have come up with this solution. It is a bit cumbersome but makes your life easier if you are in the same situation. With alerter, every time the old RunPythonScript command is called you need press enter end the new commands start automatically afterwards.
I wanted to share it because it can be helpful until a solid solution comes from McNeel. It shouldn’t be too much work to lead the old RunPythonScript command to the new ScriptEditor command.
I see that whenever you type EditPythonScript command (the old command) it redirects to ScriptEditor, which is awesome.
Can’t we have something similar for the old RunPythonScript command so that it redirects to something like ScriptEditor Run?
Again, it has nothing to do with the old RunPythonScript command not working. It works. It just cannot find the path of the python file name that you provide. Adding the folders including the python files to Options > Files > Search Paths, only seems to be working for the new ScriptEditor and not for the old EditPythonScript, hence RunPythonScript either… So, the fix can be easier than it looks.
Just for your information, I have already saved my folders in Script Editor > Options > IronPython2 > Module Search Paths. So my guess is that maybe this list isn’t talking to the old RunPythonScript command for some reason…
I love to use the new features of the new BETA. I couldn’t wait any longer. I imported my .RUI files into VSCode and replaced all ‘RunPythonScript’ commands with ‘ScriptEditor Run’. It works well.