[IronPython] Ref to "." to be omitted from sys.path. Objections?

Michael Foord fuzzyman at voidspace.org.uk
Sun Jan 23 22:55:44 CET 2011

On 23/01/2011 21:14, Jeff Hardy wrote:
> On Sun, Jan 23, 2011 at 12:36 PM, Daniel D.<dvdotsenko at gmail.com>  wrote:
>>> I committed the patch using '.' as  the current directory; if anyone
>>> (Dino?) needs the fully resolved path ...
>> The "." (rather "") in cPy is a neat trick. It's added only in
>> "interactive" (console, "-c") cases and allows you to change the CWD
>> to the dir you want and have your custom modules picked up as local
>> wherever dir you change to from within the console. Do that all the
>> time when deving. Setting fully-resolved path to CWD feels limiting in
>> that context.
> You mean switching using os.chdir, I presume? That works under ipy
> using '.' (which makes sense). Is there something special about how
> CPython uses '' instead of '.' that ipy should by emulating?

Interesting, the empty string is indeed in sys.path from the interactive 
interpreter (I thought it would be '.') yet:

 >>> import os
 >>> os.listdir('')
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
OSError: [Errno 2] No such file or directory: ''

All the best,

Michael Foord

> - Jeff
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing http://www.sqlite.org/different.html

More information about the Ironpython-users mailing list