[Bf-python] PyRun_File vs PyRun_String
Martin Poirier
theeth at yahoo.com
Sun May 11 14:31:50 CEST 2008
--- On Sun, 5/11/08, Campbell Barton <ideasman42 at gmail.com> wrote:
> From: Campbell Barton <ideasman42 at gmail.com>
> Subject: Re: [Bf-python] PyRun_File vs PyRun_String
> To: "Blender Foundation Python list" <bf-python at blender.org>
> Date: Sunday, May 11, 2008, 8:14 AM
> >From looking about on the net a lot of other people have
> this problem,
> this seems the most common solution.
>
> PyRun_SimpleString("execfile('foo.py')")
>
> - In blender all the string parsing can be avoided with
> this..
>
> char pystring[sizeof(script->scriptname) + 14];
> pystring[0] = '\0';
> sprintf(pystring, "execfile('%s')",
> script->scriptname);
> py_res = PyRun_String( pystring, Py_file_input, py_dict,
> py_dict );
How does that run a file with cr/lf that was loaded in the text editor and modified (but not saved)?
Martin
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
More information about the Bf-python
mailing list