Re: [IronPython] Porting from CPython: Figuring out the calling code's directory

2008-11-08 Thread orip
Great idea Michael, thanks! A small price to pay to make it work with IronPython. I'll probably make it optional (affect only IronPython users). On Nov 7, 1:21 pm, Michael Foord <[EMAIL PROTECTED]> wrote: > Why not change the API to: > >    return testoob.collecting.collect_from_files("test_*.py",

Re: [IronPython] Porting from CPython: Figuring out the calling code's directory

2008-11-08 Thread orip
. > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ori Peleg > Sent: Thursday, November 06, 2008 2:27 PM > To: [EMAIL PROTECTED] > Subject: [IronPython] Porting from CPython: Figuring out the calling code's > directory > > Hi, > > I'm portin

Re: [IronPython] Porting from CPython: Figuring out the calling code's directory

2008-11-07 Thread Michael Foord
Ori Peleg wrote: [snip...] BTW - the use case is for building test suites: you can have a subpackage of tests and define __init__.py like this: def suite(): import testoob return testoob.collecting.collect_from_files("test_*.py") Why not change the API to: return testoob.collecting.

Re: [IronPython] Porting from CPython: Figuring out the calling code's directory

2008-11-06 Thread Dino Viehland
name comparison heuristic or private reflection or something to bring it all together). From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ori Peleg Sent: Thursday, November 06, 2008 2:27 PM To: users@lists.ironpython.com Subject: [IronPython] Porting from CPython: Figuring out the

[IronPython] Porting from CPython: Figuring out the calling code's directory

2008-11-06 Thread Ori Peleg
Hi, I'm porting Testoob to IronPython and have a module function that needs to know the filename where the code calling it is defined. In CPython I get the current frame with sys._getframe(), then climb the stack with frame.f_back until I find a different file: def _first_external_frame(): im