Profile Picture

Directory for the python script being loaded

Posted By RobertoColombo 2 Months Ago
You don't have permission to rate!
Author
Message
RobertoColombo
RobertoColombo
Posted 2 Months Ago
View Quick Profile
Distinguished Member

Distinguished Member (6.4K reputation)Distinguished Member (6.4K reputation)Distinguished Member (6.4K reputation)Distinguished Member (6.4K reputation)Distinguished Member (6.4K reputation)Distinguished Member (6.4K reputation)Distinguished Member (6.4K reputation)Distinguished Member (6.4K reputation)Distinguished Member (6.4K reputation)

Group: Forum Members
Last Active: Last Month
Posts: 1.6K, Visits: 3.0K
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

My PC:
OS: Windows 10 Pro English 64-bit / CPU: Intel i7-9700 3.6GHz / MB: ASUS ROG Strix Z390  RAM: 32GB DDR4 2.6GHz / HD: 2TB+3TB  /  
SSD: 2x512GB Samsung 860 EVO / 
VB: Palit GTX2080 TI GamingPro 11GB / AB: embedded in the MB and VB (audio from the VB with an HDMI splitter) / DirectX: 12

The-any-Key
The-any-Key
Posted 2 Months Ago
View Quick Profile
Veteran Member

Veteran Member (617 reputation)Veteran Member (617 reputation)Veteran Member (617 reputation)Veteran Member (617 reputation)Veteran Member (617 reputation)Veteran Member (617 reputation)Veteran Member (617 reputation)Veteran Member (617 reputation)Veteran Member (617 reputation)

Group: Forum Members
Last Active: 4 hours ago
Posts: 132, Visits: 760

# 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)    




iClone 7, 3DXchange 7 Pipeline, CC3 Pipeline, CT8 Pipeline, Iray, Live Face, iPhone Xr, Win 10, i9 9900K ~5GHz, Nvidia RTX 2080 8GB, 16GB Ram, M.2 SSD
RobertoColombo
RobertoColombo
Posted 2 Months Ago
View Quick Profile
Distinguished Member

Distinguished Member (6.4K reputation)Distinguished Member (6.4K reputation)Distinguished Member (6.4K reputation)Distinguished Member (6.4K reputation)Distinguished Member (6.4K reputation)Distinguished Member (6.4K reputation)Distinguished Member (6.4K reputation)Distinguished Member (6.4K reputation)Distinguished Member (6.4K reputation)

Group: Forum Members
Last Active: Last Month
Posts: 1.6K, Visits: 3.0K
Thanks Andreas.
I did not see that method in the library doc... Blink

Cheers

  Roberto


My PC:
OS: Windows 10 Pro English 64-bit / CPU: Intel i7-9700 3.6GHz / MB: ASUS ROG Strix Z390  RAM: 32GB DDR4 2.6GHz / HD: 2TB+3TB  /  
SSD: 2x512GB Samsung 860 EVO / 
VB: Palit GTX2080 TI GamingPro 11GB / AB: embedded in the MB and VB (audio from the VB with an HDMI splitter) / DirectX: 12

The-any-Key
The-any-Key
Posted 2 Months Ago
View Quick Profile
Veteran Member

Veteran Member (617 reputation)Veteran Member (617 reputation)Veteran Member (617 reputation)Veteran Member (617 reputation)Veteran Member (617 reputation)Veteran Member (617 reputation)Veteran Member (617 reputation)Veteran Member (617 reputation)Veteran Member (617 reputation)

Group: Forum Members
Last Active: 4 hours ago
Posts: 132, Visits: 760
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.



iClone 7, 3DXchange 7 Pipeline, CC3 Pipeline, CT8 Pipeline, Iray, Live Face, iPhone Xr, Win 10, i9 9900K ~5GHz, Nvidia RTX 2080 8GB, 16GB Ram, M.2 SSD
RobertoColombo
RobertoColombo
Posted 2 Months Ago
View Quick Profile
Distinguished Member

Distinguished Member (6.4K reputation)Distinguished Member (6.4K reputation)Distinguished Member (6.4K reputation)Distinguished Member (6.4K reputation)Distinguished Member (6.4K reputation)Distinguished Member (6.4K reputation)Distinguished Member (6.4K reputation)Distinguished Member (6.4K reputation)Distinguished Member (6.4K reputation)

Group: Forum Members
Last Active: Last Month
Posts: 1.6K, Visits: 3.0K
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


My PC:
OS: Windows 10 Pro English 64-bit / CPU: Intel i7-9700 3.6GHz / MB: ASUS ROG Strix Z390  RAM: 32GB DDR4 2.6GHz / HD: 2TB+3TB  /  
SSD: 2x512GB Samsung 860 EVO / 
VB: Palit GTX2080 TI GamingPro 11GB / AB: embedded in the MB and VB (audio from the VB with an HDMI splitter) / DirectX: 12




Reading This Topic