Get inputResultData file path in Python

   3206   6   2
User Avatar
Member
159 posts
Joined: Feb. 2018
Offline
Say I want to load the upstream output file, I use an python processor node with
upstream_item.inputResultData[0][0]
, but the returned path is begin with “__PDG_DIR__”(sometimes is the full path).
__PDG_DIR__/geo/xxx.bgeo.sc
I've tried to use expandString() but with no luck.
Now I just replace the “__PDG_DIR__” with the absolute path, is there a better way to get the input result file? am I doing something wrong here?
Thank you.
User Avatar
Member
603 posts
Joined: Sept. 2016
Offline
The __PDG_DIR__ indicates that the path is ‘delocalized’, so you need to localize it to get an absolute path.

self.scheduler.localizePath(upstream_item.inputResultData[0][0])
User Avatar
Member
201 posts
Joined: July 2015
Offline
Cool! Stuff like this really makes me look forward to the API masterclass.
Manuel Köster - Senior Technical Artist @Remedy Entertainment

https://www.remedygames.com/ [www.remedygames.com]
http://shadesoforange.de/ [shadesoforange.de]
https://twitter.com/ShadesOfOrange_ [twitter.com]
User Avatar
Member
252 posts
Joined:
Offline
Hi,

self.schedulercurrently seems to return _pdg.PySchedulerType object.
This object doesn't have any method called localizePath().

Is there another way to expand the path?

I want to expand __PDG_DIR__so that i could use it with hou.imageResolution().

H18.0.495 Non-commercial
User Avatar
Member
252 posts
Joined:
Offline
okay, got something working.

managed to use pdg.File-> localizePathmethod:

parent = upstream_items[0] # parent work_item with output file
img = str(parent.inputResultData[0]) # get the input file/path -> __PDG_DIR__/path/to/file
f = pdg.File() # create new File obejct
f.path = img # set (store) the path value
loc = f.localizePath(self.scheduler) # convert the stored path value

locis now expanded


H18.0.495 Non-commercial
Edited by galagast - June 14, 2020 10:50:08
User Avatar
Member
603 posts
Joined: Sept. 2016
Offline
galagast
self.schedulercurrently seems to return _pdg.PySchedulerType object.
This object doesn't have any method called localizePath().

self.scheduler should have localizePath(), it won't show up in the auto-completion but it's there.
User Avatar
Member
252 posts
Joined:
Offline
chrisgreb
self.scheduler should have localizePath(), it won't show up in the auto-completion but it's there.
oh my! haha indeed it does work! thanks!

i only also checked on the PySchedulerTypedocs, but found no localizePath()method, thus i assumed that it didnt have it.
Edited by galagast - June 15, 2020 00:56:28
  • Quick Links