Severin wrote:
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.
Have a function that does the path relivatisation for you. The call can
then be:
open(getpath('settings.ini'),'r')
or even:
open_from('settings.ini','r')
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 :)
Well - running Python code from a hosted environment need not be a hack.
But depending on the current directory probably is...
Michael
Severin
On Fri, Jan 30, 2009 at 6:16 PM, Slide <slide.o....@gmail.com
<mailto:slide.o....@gmail.com>> wrote:
On Fri, Jan 30, 2009 at 10:01 AM, Severin <s...@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@lists.ironpython.com <mailto:Users@lists.ironpython.com>
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
------------------------------------------------------------------------
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com