Issue1284344
Created on 2005-09-07.22:47:24 by leouserz, last changed 2006-09-07.03:46:43 by cgroves.
Messages | |||
---|---|---|---|
msg1031 (view) | Author: Deleted User leouserz (leouserz) | Date: 2005-09-07.22:47:24 | |
I ran across this in trying to figure out why my jyleo.py startup script was failing. What is happening is that once a jython src file is compiled it has the __file__ attribute permanently written into the compiled file. This makes it impossible to derive correctly the place where the file is being loaded from. Once compiled, you can move a set of jython code to another machine or a different directory and code that needs correct __file__ attributes will mysteriously fail--> that is until you find out that the __file__ attribute is returning a path that only exists on another machine. The requested fix: make the __file__ attribute correctly reflect its location on the filesystem. The severity of this depends upon if your application/script depends upon this information to function properly. In my case it does, so from my perspective it is a *bad* bug. For others it may not even be a bug. |
|||
msg1032 (view) | Author: James William Pye (jwpye) | Date: 2006-05-14.00:51:00 | |
Logged In: YES user_id=1044177 I have experienced a __file__ related issue as well. It seems that this is one of the subtle features that most Python implementations seem to miss(ironpython seems to be the only one that got it right, but they seem to be missing the os module, so I dunno if they are actually "better") jwp@lit:~/jythonRelease_2_2alpha1 % uname -a FreeBSD lit 6.1-RC FreeBSD 6.1-RC #5: Mon Apr 24 21:21:02 MST 2006 root@lit:/usr/obj/usr/src/sys/void amd64 jwp@lit:~/jythonRelease_2_2alpha1 % cat ../printfile.py print '__file__ =', repr(__file__) jwp@lit:~/jythonRelease_2_2alpha1 % ./jython ../printfile.py __file__ =Traceback (innermost last): File "../printfile.py", line 1, in ? NameError: __file__ Also, interestingly, it appears to have printed the first element in the print statement(printing while iterating over the list?) Oh, and it does the same thing when I try to import the 'printfile' module. If this is not deemed a bug, perhaps it should be mentioned in the FAQ. Similarly, I can't find much of anything on ironpython's lack of an os module for posix systems. |
|||
msg1033 (view) | Author: Charlie Groves (cgroves) | Date: 2006-09-07.03:46:43 | |
Logged In: YES user_id=1174327 Fixed in r2925 tested by test392 |
History | |||
---|---|---|---|
Date | User | Action | Args |
2005-09-07 22:47:24 | leouserz | create |
Supported by Python Software Foundation,
Powered by Roundup