[Bf-python] Text buffers updating
Carlos López
klopes at unizar.es
Tue May 3 12:34:29 CEST 2005
joeedh wrote:
> Carlos López wrote:
>
>> I'm writing a script which uses a text buffer as 'config file', by
>> way of it stores a list of variables, which are then imported from
>> the script. But once the buffer is created, It can't be updated: even
>> unliking it (deleting) and creating it again, the old buffer is
>> imported. Is there a problem whit this?
>
>
> text.clear() clears (but doesn't unlink) the buffer.
>
> so, you load the buffer with text.asLines() or whatever into
> something, update it, then clear it. then just write it back with
> text.write().
Mmm... Good idea, but it doesn´t work. I'm using 2 scripts: one is a
GUI, which makes the configuration buffer: a list of variables. The
other is a change-frame linked ("main") to a scene. The config buffer
automatic edition works well, but the the main loads always the first
buffer loaded (via "import buffer", then using "buffer.variable"), any
posterior edition works.
Getting the point:
Write a buffer assigning variables, and name it "config.py", p.e:
a = [1,3]
x = 4
Write another buffer:
import config
print dir(config)
Execute it, the you get:
['__builtins__', '__doc__', '__file__', '__name__', 'a', 'x']
Now edit config.py adding a new variable:
a = [1,3]
x = 4
t = 0
Run the above script again, the new variable is not imported: the buffer
isn't anyway updated.
Any idea?
Klopes
>
> joeedh
> _______________________________________________
> Bf-python mailing list
> Bf-python at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-python
>
More information about the Bf-python
mailing list