|
From: brian z. <bz...@zi...> - 2001-05-15 22:04:28
|
Tom,
Since Java has no means of changing the current working directory, Jython will not be able to implement os.chdir() without resorting to JNI.
As for not finding os.path, that might be a jview thing. Try:
clspack -auto
and see if that helps.
brian
At 03:51 PM 5/15/2001 -0400, Emerson, Tom # El Monte wrote:
>[Background for the folks at jython-dev: I'm trying to "port" a program called "Zope" to the HP3000 platform. Zope is written in Python, but the version of Python that is currently available for the HP is *just* one version shy of what I need...]
>
>Well, here's an interesting twist...
>
>Since the version of python on the HP is 1.5.1 and Zope needs 1.5.2, someone suggested "jython" [a.k.a. jpython] -- a java implementation of python -- as a workaround. Intriguingly, it SEEMS to work [to a degree] however I'm getting a compilation error:
>
>:jython wo_pcgi.py
>
>------------------------------------------------------------------------------
>Compiling python modules
>Traceback (innermost last):
> File "wo_pcgi.py", line 116, in ?
> File "wo_pcgi.py", line 104, in main
> File "/EMERSON/SRC/Zope-2.3.2-src/inst/build_extensions.py", line 90, in ?
> File "/EMERSON/SRC/Zope-2.3.2-src/inst/do.py", line 98, in ?
>AttributeError: class 'org.python.modules.os' has no attribute 'chdir'
>:
>
>Equally interesting, if I try this on a Windows PC, as in:
>
>C:\bin\Zope-2.3.2-src>\bin\jython wo_pcgi.py
>
>it fails with the following:
>
>Traceback (innermost last):
> File "wo_pcgi.py", line 116, in ?
> File "wo_pcgi.py", line 101, in main
> File "wo_pcgi.py", line 95, in setup
>AttributeError: class 'org.python.modules.os' has no attribute 'path'
>C:\bin\Zope-2.3.2-src>
>
>Interesting that "org.python.modules.os" comes up with different errors for different systems -- here is the file:
>
>// Copyright ` Corporation for National Research Initiatives
>package org.python.modules;
>
>import org.python.core.*;
>
>public class os implements ClassDictInit {
> public static String[] __depends__ = new String[] {"javaos", };
>
> // An ugly hack, but it keeps the site.py from CPython2.0 happy
>
> public static String __file__ =
> Py.getSystemState().prefix.toString() + "/Lib/javaos.py";
>
> public static void classDictInit(PyObject dict) {
> // Fake from javaos import *
> PyFrame frame = new PyFrame(null, dict, dict, null);
> org.python.core.imp.importAll("javaos", frame);
> }
>}
>However, I suspect the problem lies in "PyFrame" which begins with:
>
>public class PyFrame extends PyObject
>{
> public PyFrame f_back;
> public PyTableCode f_code;
> public PyObject f_locals;
> public PyObject f_globals;
> public int f_lineno;
> public PyObject f_builtins;
> public PyObject[] f_fastlocals;
> [and then gets into actual routine definitions, so the above is the extent of locally defined attributes...]
>
>I'm presuming then, from the "extends" statement, that this is expected to be in "PyObject.java", but I'm reaching my limit of "searching for it..." -- does anyone have a suggestion to kick around? [Charlie -- feel free to copy this to the lazug list/group]
>
>More FYI info: here's the java version on the HP:
>java version "JavaVM-1.3.0"
>Java(TM) 2 Runtime Environment, Standard Edition (build A.30.00 built on 11/28/0
>0-10:09)
>Classic VM (build A.30.00 02/05/01-15:43, build green threads, HP JIT)
>:
>
>and on windows: (jview)
>Microsoft (R) Command-line Loader for Java Version 5.00.3309
>Copyright (C) Microsoft Corp 1996-2000. All rights reserved.
>
>Tom Emerson
>Sr. Systems Analyst
>Global Payments
>tom...@gl...
>626-258-4309
>626-350-3832 FAX
|