Directory for the python script being loaded


https://forum.reallusion.com/Topic400371.aspx
Print Topic | Close Window

By RobertoColombo - 5 Years Ago
Hi,

can anybody (or Any-Key, or any-Kelley...  Wink suggest how to retrieve the directory where the Python script being loaded  into "Script=>Load Python" is stored  ?

Thanks
Regards

  Roberto
By The-any-Key - 5 Years Ago

# Import os module
import os
# Get path for this running py script
dirOfThisFileRunning=os.path.dirname(os.path.realpath(__file__))
# Print in console
print(dirOfThisFileRunning)    
By RobertoColombo - 5 Years Ago
Thanks Andreas.
I did not see that method in the library doc... Blink

Cheers

  Roberto
By The-any-Key - 5 Years Ago
RobertoColombo (1/6/2019)
Thanks Andreas.
I did not see that method in the library doc... Blink

Cheers

  Roberto


The docs is only for the API for iClone. You have the entire python world outside that :-)
Just Google "python get path script run in" and you get what you need.
By RobertoColombo - 5 Years Ago
Hi Andreas,

yes, I know about Python and Qt doc, but I missed this method...
I am surely not familiar yet with all the classes out there Wink

  Roberto