[IronPython] Embedding IronPython 2.0

Slide slide.o.mix at gmail.com
Fri Jan 30 18:34:48 CET 2009


You could also make the files in the subdirectory a module and write a
__init__.py to import the other items.

On Fri, Jan 30, 2009 at 10:28 AM, Severin <seob at gmx.ch> 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.
> 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
>>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>



-- 
slide-o-blog
http://slide-o-blog.blogspot.com/



More information about the Ironpython-users mailing list