Well, if you'll take comments from "anyone", as opposed to Jython core developers, then I'll chime in.

 

Yes, it looks like in Jython 2.1, the current directory was put in  as the second item sys.path. It also looks like CPython 2.4 put the current directory as the 3rd item in sys.path. But CPython 2.5.1 does not put the current directory in sys.path at all. Nor does Jython 2.2.

 

In my opinion, that is a good change. "Explicit is better than implicit." I'd hate for the behavior of my script or program to vary depending on whatever the current directory is when it is launched, due to unexpectedly picking up random modules and packages. That is particularly a problem with Jython 2.1 which puts the current directory ahead of the system Lib directory in the path - you can even get the behavior of the standard library unexpectly modified. Also, in some environments such as running from within a servlet container or Apache, you have no control over the current directory and it may be set to something you didn't anticipate. Normally it is sufficient to your script's directory in the path ahead of everything else, which is what Jython and CPython do.

 

If you really need the current directory in sys.path, you can put it in yourself explicitly:

 

import sys, os

sys.path.insert(0, os.getcwd())

 

David H

 

 

From: jython-users-bounces@lists.sourceforge.net [mailto:jython-users-bounces@lists.sourceforge.net] On Behalf Of Mark_Melvin@amis.com
Sent: Thursday, November 29, 2007 11:21 AM
To: Mark_Melvin@amis.com
Cc: jython-users@lists.sourceforge.net
Subject: Re: [Jython-users] Current Directory No Longer on sys.path?

 


No comment on this one?  Anyone?

M.
----------------------------------------------------------


Mark_Melvin@amis.com
Sent by: jython-users-bounces@lists.sourceforge.net

11/28/2007 05:09 PM

To

jython-users@lists.sourceforge.net

cc

Subject

[Jython-users] Current Directory No Longer on sys.path?

 





Hi There,


We upgraded from Jython 2.1 to 2.2 awhile ago and just noticed a change in behaviour that I am pretty sure is not due to any change in our code.  It seems that I can no longer import scripts from the current directory (Java's "user.dir" property) the way I used to be able to.  Sure enough, if it check out sys.path in our Jython 2.1-based product, the first entry in sys.path is ".", but it is not there in our Jython 2.2-based product.  Was this a conscious change on the part of the Jython developers, or is this an accidental regression?  Can anyone else confirm this is also the case for them?


Thanks,

Mark.


AMI Semiconductor - "Silicon Solutions for the Real World"
NOTICE: 
This electronic message contains information that may be confidential or privileged. The information is intended for the use of the individual or entity named above. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you received this electronic message in error, please notify the sender and delete the copy you received.