Reading VirtualFileSystem files in Python?

Hi - I’m creating a component that uses some binary neural network files to analyze images. I discovered the Virtual File System palette entry today and thought it would help reduce external dependencies. Right on!

But… looks like my Python code can’t interpret the paths to the embedded files as I’d hoped.

If I access the virtual file’s path as the docs say, for example:

proto_path = op('virtualFile_face_nn/out1')[0,0]

I get paths like:


When I try to open this path with Python, like

proto_txt=open(proto_path, 'r'').read() , it throws a FileNotFound error.

Is there any way to access either A) an actual file path for the virtual file, or B) the content of that file? Or do these virtual files need to be ingested only by TouchDesigner nodes?

Very interested if somebody has figured this out. I’ve had success reading memory mapped files, but since the vfs component seems to be calling t-script into something built into TD I haven’t been able to hook directly into it…

That’s correct. Unfortunately the vfs files are only ingestible by File parameters at this point.
Currently the only workaround is to extract them with a tscript command: (vfs -x …)

A direct memory python interface would be useful.