Can PyNodes Output Text to File?

Hey I want to get the PyNodes to input, store, and output text data and then write the resulting data to a file. I’m just looking for someone to point me in the right direction. Thank you!

I’ve looked at the wiki API discussion and it talks about numbers and vectors, my question is about storing and writing text however.

You can do anything within a PyNode that you can do with normal python (i.e. write data from the node to a file). You can’t pass strings/text as parameters to nodes with the out of the box functionality, though.

But isn’t a PyNode only a one line statement? How could you output data in a single line?

I can’t find the documentation explaining the Node module can you give me some tips on how to do what i mentioned
earlier plzzzz =)

oh yeah remember as i stated earlier I have read the “PyNode API discussion” but that doesn’t include anything but instructions about integers and vectors

@atom: no a pynode is definitely not a single line affair
@key_eva:
basically a Node is a class that is derived from the class Blender.Node.Scripted
It should have a public interface that defined a function call() that is called for every pixel.
But, like any Python class it can override its constructor (the init() function) and stuff all sorts of additional data in the instance. So you could open a file in the init() function, store the filehandle as instance data and write data to this file in every call to the call() function.

pseudocode:

import Blender
class Bla(Blender.Node.Scripted):
def init(self, sockets):
… define input and output sockets for the node …
self.myfile=open(‘filename’, ‘w’)

def call(self):
… do things with input and output sockets here …
self.myfile.write(‘interesting stuff to write to file’)

Examples can be found on:
http://wiki.blender.org/index.php/Resources/PyNode_Cookbook

oh yeah that’s the stuff

thank you!

thank you very much! :slight_smile:

Ah, I was thinking pydriver.