Profile Picture

Directory for the python script being loaded

Posted By RobertoColombo 10 days ago
You don't have permission to rate!
Author
Message
RobertoColombo
RobertoColombo
Posted 10 days ago
View Quick Profile
Distinguished Member

Distinguished Member (6.0K reputation)Distinguished Member (6.0K reputation)Distinguished Member (6.0K reputation)Distinguished Member (6.0K reputation)Distinguished Member (6.0K reputation)Distinguished Member (6.0K reputation)Distinguished Member (6.0K reputation)Distinguished Member (6.0K reputation)Distinguished Member (6.0K reputation)

Group: Forum Members
Last Active: Yesterday
Posts: 1.5K, Visits: 2.9K
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: 16GB 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 10 days ago
View Quick Profile
Senior Member

Senior Member (355 reputation)Senior Member (355 reputation)Senior Member (355 reputation)Senior Member (355 reputation)Senior Member (355 reputation)Senior Member (355 reputation)Senior Member (355 reputation)Senior Member (355 reputation)Senior Member (355 reputation)

Group: Forum Members
Last Active: Yesterday
Posts: 76, Visits: 411

# 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
RobertoColombo
RobertoColombo
Posted 10 days ago
View Quick Profile
Distinguished Member

Distinguished Member (6.0K reputation)Distinguished Member (6.0K reputation)Distinguished Member (6.0K reputation)Distinguished Member (6.0K reputation)Distinguished Member (6.0K reputation)Distinguished Member (6.0K reputation)Distinguished Member (6.0K reputation)Distinguished Member (6.0K reputation)Distinguished Member (6.0K reputation)

Group: Forum Members
Last Active: Yesterday
Posts: 1.5K, Visits: 2.9K
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: 16GB 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 10 days ago
View Quick Profile
Senior Member

Senior Member (355 reputation)Senior Member (355 reputation)Senior Member (355 reputation)Senior Member (355 reputation)Senior Member (355 reputation)Senior Member (355 reputation)Senior Member (355 reputation)Senior Member (355 reputation)Senior Member (355 reputation)

Group: Forum Members
Last Active: Yesterday
Posts: 76, Visits: 411
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
RobertoColombo
RobertoColombo
Posted 10 days ago
View Quick Profile
Distinguished Member

Distinguished Member (6.0K reputation)Distinguished Member (6.0K reputation)Distinguished Member (6.0K reputation)Distinguished Member (6.0K reputation)Distinguished Member (6.0K reputation)Distinguished Member (6.0K reputation)Distinguished Member (6.0K reputation)Distinguished Member (6.0K reputation)Distinguished Member (6.0K reputation)

Group: Forum Members
Last Active: Yesterday
Posts: 1.5K, Visits: 2.9K
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: 16GB 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