Message12896

Author jeff.allen
Recipients Vikhe, jeff.allen
Date 2019-12-24.19:59:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1577217542.04.0.64439930299.issue2850@roundup.psfhosted.org>
In-reply-to
Content
Happy Christmas Yogita. I don't know Beanstalk, but your program doesn't reference it and isn't (AFAICT) a servlet. #2844 may be worth a look.

I do not think it is necessary to manipulate python.path as you do, and in any case, it should point to where additional Python code can be found, not the standalone JAR. Try without and see what sys.path ends up as.

However, I'm not getting the same result (Windows 10). With this program:

// Start an interpreter and check the sys.path

import org.python.util.PythonInterpreter;
import java.util.Properties;

public class Issue2850 {

    public static void main(String args[]) {
        Properties p = new Properties();
        //p.setProperty("python.path", "inst\jython-standalone-2.7.1.jar");
        PythonInterpreter.initialize(System.getProperties(), p, new String[] {});
        PythonInterpreter pythonInterp = new PythonInterpreter();
        pythonInterp.exec("import sys");
        pythonInterp.exec("print sys.path");
    }
}

and the JAR at inst\\jython-standalone-2.7.1.jar I still end up with a sensible sys.path:

PS issue2850> javac -cp "inst\jython-standalone-2.7.1.jar" Issue2850.java
PS issue2850> java -cp ".;inst\jython-standalone-2.7.1.jar" Issue2850
['...\\issue2850\\inst\\Lib', '...\\issue2850\\inst\\jython-standalone-2.7.1.jar\\Lib', '__classpath__', '__pyclasspath__/', '...\\.local\\lib\\jython2.7\\site-packages']

(That last one is in my home directory, but is empty.) Notice Jython looks for a Lib directory next to the JAR (at inst/Lib), as well as inside it. Your path is relatively short but still contains the place I'd expect to find site.py.
History
Date User Action Args
2019-12-24 19:59:02jeff.allensetmessageid: <1577217542.04.0.64439930299.issue2850@roundup.psfhosted.org>
2019-12-24 19:59:02jeff.allensetrecipients: + jeff.allen, Vikhe
2019-12-24 19:59:02jeff.allenlinkissue2850 messages
2019-12-24 19:59:01jeff.allencreate