Login | Register 
FEATURES
APPLICATIONS
DOWNLOADS
EDUCATION
BLOG
WIKI
FORUM
STORE

Reading VirtualFileSystem files in Python?

General discussion about anything TouchDesigner

Reading VirtualFileSystem files in Python?

Postby evan_jones » Thu Sep 12, 2019 6:57 pm

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:

Code: Select all
proto_path = op('virtualFile_face_nn/out1')[0,0]


I get paths like:
Code: Select all
vfs:/project1/base1/virtualFile_face_nn/deploy.prototxt.txt


When I try to open this path with Python, like
Code: Select all
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?
evan_jones
 
Posts: 6
Joined: Wed Jun 05, 2019 11:18 am

Re: Reading VirtualFileSystem files in Python?

Postby pointshader » Fri Sep 13, 2019 4:43 pm

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...
Jonathan Thompson
@pointshader
http://pointshader.com
User avatar
pointshader
 
Posts: 180
Joined: Mon Nov 01, 2010 3:15 am
Location: NYC

Re: Reading VirtualFileSystem files in Python?

Postby rob » Tue Sep 17, 2019 10:14 am

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.

Cheers,
Rob
User avatar
rob
Staff
 
Posts: 1686
Joined: Tue Nov 13, 2007 1:14 am


Return to General TouchDesigner Discussion

Who is online

Users browsing this forum: No registered users and 21 guests