From: Dinu G. <gh...@da...> - 2002-02-25 17:22:19
|
Hi, I'm just starting to use Jython on OS X and run into several problems, obne of them being this: [localhost:~] dinu% jython Jython 2.1 on java1.3.1 (JIT: null) Type "copyright", "credits" or "license" for more information. >>> import os >>> os.chdir('..') Traceback (innermost last): File "<console>", line 1, in ? File "/Applications/Additions/Jython-2.1/Lib/javaos.py", line 56, in chdir OSError: [Errno 0] chdir not supported in Java: .. >>> Any ideas? Thanks, Dinu |
From: Samuele P. <ped...@bl...> - 2002-02-25 18:23:01
|
No this one is not a bug, chdir is not supported by Jython. Because it is not supported by Java. We could workaround but there is no clear win in that. It should be noted that while Jython is an implementation of Python and it is a goal that portable code between Python and Jython (www.anygui.org is example) can be written, it is not a goal that Python code written without thinking about Jython can be always ported, especially for shell-programming-like programs. Jython is Python for Java as a platform and tries to follow the platform philosophy without workarounding too much. So there are tasks for which Python is good and Jython not so much, changing this is a low priority thingy. regards, Samuele Pedroni. ----- Original Message ----- From: Dinu Gherman <gh...@da...> To: <jyt...@li...> Sent: Monday, February 25, 2002 6:22 PM Subject: [Jython-users] OSError: [Errno 0] chdir not supported in Java? > Hi, > > I'm just starting to use Jython on OS X and run into several > problems, obne of them being this: > > [localhost:~] dinu% jython > Jython 2.1 on java1.3.1 (JIT: null) > Type "copyright", "credits" or "license" for more information. > >>> import os > >>> os.chdir('..') > Traceback (innermost last): > File "<console>", line 1, in ? > File "/Applications/Additions/Jython-2.1/Lib/javaos.py", line 56, in chdir > OSError: [Errno 0] chdir not supported in Java: .. > >>> > > Any ideas? > > Thanks, > > Dinu > > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > |
From: Dinu G. <gh...@da...> - 2002-02-26 08:02:07
|
Samuele Pedroni <ped...@bl...>: > No this one is not a bug, > chdir is not supported by Jython. > Because it is not supported by Java. > We could workaround > but there is no clear win in that. > > It should be noted that while Jython is > an implementation of Python and > it is a goal that portable code > between Python and Jython > (www.anygui.org is example) can be > written, > > it is not a goal that Python code > written without thinking about Jython > can be always ported, especially > for shell-programming-like programs. > > Jython is Python for Java as a platform > and tries to follow the platform philosophy > without workarounding too much. > > So there are tasks for which Python > is good and Jython not so much, > changing this is a low priority thingy. > > regards, Samuele Pedroni. Ciao Samuele, I see this has been asked before already on this list. Sorry for not checking earlier! But I also see that it is not impossible to implement chdir and friends in Java despite its security concerns as the following should make clear: http://www.hio.hen.nl/java/nl/nl/hen/ict/unix/Unix.html Needless to say, I'd opt for Jython being more similar to Python instead of Java, if for no other reason than the higher similarity of the "Jython" string to "Python" than to "Java"! ;-) Seriously, if it's possible to use chdir-like stuff why not add it and make both happy, Java people missing it *and* Python folks reusing their scripts...? Maybe some Java guys will be more inclined to being dragged over to Python? Dinu |
From: Samuele P. <pe...@in...> - 2002-02-26 10:33:41
|
Have you seen that it requires a JNI lib? Samuele Pedroni. ----- Original Message ----- From: Dinu Gherman <gh...@da...> To: Samuele Pedroni <pe...@in...> Cc: <jyt...@so...> Sent: Tuesday, February 26, 2002 9:01 AM Subject: Re: [Jython-users] OSError: [Errno 0] chdir not supported in Java? > Samuele Pedroni <ped...@bl...>: > > > No this one is not a bug, > > chdir is not supported by Jython. > > Because it is not supported by Java. > > We could workaround > > but there is no clear win in that. > > > > It should be noted that while Jython is > > an implementation of Python and > > it is a goal that portable code > > between Python and Jython > > (www.anygui.org is example) can be > > written, > > > > it is not a goal that Python code > > written without thinking about Jython > > can be always ported, especially > > for shell-programming-like programs. > > > > Jython is Python for Java as a platform > > and tries to follow the platform philosophy > > without workarounding too much. > > > > So there are tasks for which Python > > is good and Jython not so much, > > changing this is a low priority thingy. > > > > regards, Samuele Pedroni. > > > Ciao Samuele, > > I see this has been asked before already on this list. > Sorry for not checking earlier! But I also see that it > is not impossible to implement chdir and friends in > Java despite its security concerns as the following > should make clear: > > http://www.hio.hen.nl/java/nl/nl/hen/ict/unix/Unix.html > > Needless to say, I'd opt for Jython being more similar > to Python instead of Java, if for no other reason than > the higher similarity of the "Jython" string to "Python" > than to "Java"! ;-) > > Seriously, if it's possible to use chdir-like stuff why > not add it and make both happy, Java people missing it > *and* Python folks reusing their scripts...? Maybe some > Java guys will be more inclined to being dragged over > to Python? > > Dinu > > |
From: <bc...@wo...> - 2002-02-26 15:04:25
|
[Dinu Gherman] >Hi, > >I'm just starting to use Jython on OS X and run into several >problems, obne of them being this: > >[localhost:~] dinu% jython >Jython 2.1 on java1.3.1 (JIT: null) >Type "copyright", "credits" or "license" for more information. >>>> import os >>>> os.chdir('..') >Traceback (innermost last): > File "<console>", line 1, in ? > File "/Applications/Additions/Jython-2.1/Lib/javaos.py", line 56, in chdir >OSError: [Errno 0] chdir not supported in Java: .. >>>> > >Any ideas? As Samuele has explained, we can't do a chdir in 100% java and we will *never* include JNI code with the jython distribution. But we could (as we already do for the readline module) include support code that require the presence of a JNI module to work. So if anybody needed chdir() or chmod() or the full stat() values badly enough, she could create a copy of the javaos.py module that used one of the JNI module (there are several such candidates). We could then add a mechanisme to jython (in the registry) that allowed users to choose either the existing 100% pure java version of "os" or one the JNI alternatives. The fact that I haven't maintained jnios for quite a while should be a good indication that I don't need chdir() myself. regards, finn |
From: Dinu G. <gh...@da...> - 2002-02-26 15:45:39
|
Finn Bock <bc...@wo...>: > As Samuele has explained, we can't do a chdir in 100% java and we will > *never* include JNI code with the jython distribution. Thanks for the clarification! I got the same explanation from Samuele over private email. Thanks, Samuele! > But we could (as we already do for the readline module) include support > code that require the presence of a JNI module to work. So if anybody > needed chdir() or chmod() or the full stat() values badly enough, she > could create a copy of the javaos.py module that used one of the JNI > module (there are several such candidates). > > We could then add a mechanisme to jython (in the registry) that allowed > users to choose either the existing 100% pure java version of "os" or > one the JNI alternatives. > > The fact that I haven't maintained jnios for quite a while should be a > good indication that I don't need chdir() myself. I'll check soon if I really need chdir or if I can replace it somehow... In fact, what I'm trying to do is port the ReportLab toolkit to Jython, and chdir is what seems to prevent the test suite (and some tools and demos) from working. So, my frustration is maybe more with Java than with Jython and surely I should have better investigated the issues instead of showing my Java ignorance. Sorry for that! What I'd suggest is some sort of collection of "porting stories" (Python to Jython) and/or issues to expect when doing this kind of thing. I'm not sure the FAQ is the best place for that, but maybe I'm wrong. OTOH, maybe it is too much to ask from Python programmers to code in a Jython-friendly way? Well, at least it would be helpful to know where to expect potential pitfalls. What do people think? The good news is that many parts of ReportLab seem to be working ok, especially the vector graphics stuff (after fixing the list builtin function)! Regards, Dinu |
From: Mats W. <ma...@la...> - 2002-02-28 20:03:23
|
>What I'd suggest is some sort of collection of "porting stories" >(Python to Jython) and/or issues to expect when doing this kind >of thing. I'm not sure the FAQ is the best place for that, but >maybe I'm wrong. I think a "porting FAQ", whether integrated with the main FAQ or not, is always a good idea. It provides a way to capture particular issues that maybe don't belong in the main docs, but still can save folks some time if documented somewhhere. |