[IronPython] odd IronPython behavior?

JoeSox joesox at gmail.com
Tue Jun 27 02:38:20 CEST 2006


In short, I am observing IronPython completely go thru the below
method and only to return empty, while other Python environments
return a value and exit on the first return statement.  I believe this
may be some sort of bug. Can someone confirm this for me, otherwise I
will need to troubleshoot this more. "filename" is assigned with one
file name in both IronPython and Python.  I don't know if
os.listdir(path) is operational in IronPython or I am not loading
paths in there or what.
I have some modified ConceptNet script files and I almost have it
running in IronPython which is exciting but as you can see I am still
working on some things.

Thanks, as always.

====method ...
    def find_file(self,filename):

        if filename in os.listdir('.'):
            return './'+filename

        if os.environ.has_key('MONTYLINGUA'):
            csplits=os.environ['MONTYLINGUA'].split(';')
            csplits=map(lambda groupss:groupss.strip(),csplits)
            for enabled_arr in csplits:
                try :
                    if filename in os.listdir(enabled_arr):
                        return enabled_arr+'/'+filename
                except :
                    pass
        if os.environ.has_key('PATH'):
            csplits=os.environ['PATH'].split(';')
            csplits=map(lambda groupss:groupss.strip(),csplits)
            for enabled_arr in csplits:
                try :
                    if filename in os.listdir(enabled_arr):
                        return enabled_arr+'/'+filename
                except :
                    pass
        return ''


-- 
Later, Joe



More information about the Ironpython-users mailing list