[IronPython] Embedding IronPython 2.0

Severin seob at gmx.ch
Fri Jan 30 18:28:43 CET 2009


yes, thats what I did.

but then I have relative path's in the python code. to open a file for
instance.

lets say ./py is my subdirectory.

there I have a settings.ini and a main.py file. adding ./py to the path I am
able to run main.py with the DLR but not doing something like
open('settings.ini','r') in the python code.

so basically what I want is that calling os.getcwd() returns the ./py
subdirectory.

well, I try to change the current working directory in the python code (or
just put the python files in the main directory). this should do the job,
but is not really nice. I guess the whole thing is a hack anyway :)

Severin

On Fri, Jan 30, 2009 at 6:16 PM, Slide <slide.o.mix at gmail.com> wrote:

> On Fri, Jan 30, 2009 at 10:01 AM, Severin <seob at gmx.ch> wrote:
> > Good point! I forgot that I was having the *.py files in a subdirectory.
> > Is it also possible to set the 'current' directory for the engine?
> > For instance I would like to have the engine living in a subfolder of my
> > project and then all path's would be relative to this subfolder.
> > thank you,
> > Severin
>
> <snip>
>
> You could add the subdirectory to sys.path.
>
> slide
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20090130/5ae07605/attachment.html>


More information about the Ironpython-users mailing list