Search - User list
Full Version: Get inputResultData file path in Python
Root » PDG/TOPs » Get inputResultData file path in Python
EricSheng
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.
chrisgreb
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])
shadesoforange
Cool! Stuff like this really makes me look forward to the API masterclass.
galagast
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
galagast
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
chrisgreb
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.
galagast
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.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB