Alexey,
 
Thanks for posting this insight --> the time it has saved me is going to be huge.  It certainly does appear that the __file__ attribute gets compiled into the class file.  I took some code from linux and looked at it on XP, and the __file__ was the path on the Linux machine!  This can potentially explain much if not all of the odd __file__ based behavior I have been seeing.( Note this doesn't from what I can tell explain the module/java package class ).  The implications of this are that for any distribution you have to force the jython code to be recompiled when it is taken to any new machine, or moved for that matter.  I thinking that this is definately a bug as well,  should not the __file__ attribute reflect its real home?
 
thanks again, this has helped fix my bewildered brain,
leouser


"Alexey N. Solofnenko" <A.Solofnenko@mdl.com> wrote:
Maybe it is related - I noticed that __file__ attribute is compiled into
class file. I ran Jython script over shared drive on Windows and then on
Solaris I got Windows path in __file__ attribute.

- Alexey.

Leo User wrote:
> Hello folks,
>
> I ran into this by chance yesterday. What is happening is if a module
> is imported from a directory but the current directory has a
> subdirectory of the same name as the module the __file__ attribute
> does not turn out right.
>
> example:
> file showproblem.py:
>
> import showproblem
> if __name__ == "__main__":
> ...print "Name of __file__ is %s" % showproblem.__file__
>
> if I run this within a directory without a subdirectory that has the
> same name as 'showproblem' everythings ok.
>
> But if I run it in a directory with a subdirectory called
> 'showproblem', the __file__ is None.
>
> Ive only verified it on Linux. I suspected that the whole mechanism
> was broken for awhile but after some testing have narrowed it to this
> case. I wager that for most of the time a user may not be affected by
> it. But when it does hit, it is odd. I couldn't get jyleo to run in
> my home directory because of this. Python appears to do it ok, so Im
> pretty sure this is a bug.
>
> leouser
>
>
> ------------------------------------------------------------------------
> Yahoo! Mail
> Stay connected, organized, and protected. Take the tour
>

--
------------------------------------------------------------------------
/ Alexey N. Solofnenko
MDL Information Systems, Inc.
work: 510-357-2222x1726
home: http://trelony.cjb.net/
/


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jython-dev mailing list
Jython-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-dev


Start your day with Yahoo! - make it your home page