PYTHONPATH and embedding python

Ignacio Vazquez-Abrams ignacio at openservices.net
Wed Oct 10 02:55:13 EDT 2001


On Wed, 10 Oct 2001, Ignacio Vazquez-Abrams wrote:

> On Tue, 9 Oct 2001, Ken Seehof wrote:
>
> > // untested code:
> >   char *path, *newpath;
> >   path=Py_GetPath();
> >   newpath=new char[strlen(path)+4];
> >   strcpy(newpath, path);
> >   strcat(newpath, ":.");  // ":." for unix, or ";." for windows
> >   PySys_SetPath(newpath);
> >   free(newpath);
>
> D'oh! Yeah, that's what I meant. I guess I never noticed anything because the
> module I used to test it is this " big.

Well, except for the new[]/free mixing of course. the call to free should
probably be a del[] (I think that's it; I can't find my copies of EC++ and
MEC++ right now...).

-- 
Ignacio Vazquez-Abrams  <ignacio at openservices.net>





More information about the Python-list mailing list