[Bf-python] PyRun_File vs PyRun_String
Campbell Barton
ideasman42 at gmail.com
Mon May 12 10:44:26 CEST 2008
Loading text as a blender textblock seems overkill.
Why not just use PyRun_File and ifdef WIN32 to use
PyRun_String("execfile('.....")?
On Sun, May 11, 2008 at 9:51 PM, Willian Padovani Germano
<wpgermano at gmail.com> wrote:
> Hi,
>
> Campbell: I wrote that comment about PyRun_File, back when scripts from
> menus functionality was added. First I used PyRun_File, it worked fine
> under Linux. But when committed to cvs, we got reports about crashes on
> Windows. I searched around and saw that comment on the Python C/API
> reference manual. So then I changed it to PyRun_String and also had to
> parse the file to fix line ending issues, after more error reports.
>
> Besides your proposed solution, another thing that could be done is to
> use Blender's add_text() function, since Blender doesn text cleanup
> well, afaik. Add text to Blender, run it (or first get it to a buffer),
> then remove the text as soon as it isn't needed anymore.
>
> Don't know if there's any chance of this removal crashing Blender in
> special circumstances (open Text Editor win with no texts or whatever),
> but it's worth testing, at least. I mentioned this to Nathan
> (jesterKing) some time ago, since PyNodes will also need code to load
> scripts directly from the file system, a feature to be added after this
> release.
>
> --
> Willian
>
>
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python
>
More information about the Bf-python
mailing list