Message12728

Author rkanumola
Recipients rkanumola
Date 2019-10-30.07:40:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1572421250.61.0.301210956979.issue2818@roundup.psfhosted.org>
In-reply-to
Content
We are using PythonInterpreter to interact of Redis script data which was invoked through Python script. And we are not able to import redis module and getting the folowing error. If the PythonInterpreter is not compatible with Redis module can you please check and give us this compatability .

Traceback (most recent call last):
  File "<string>", line 4, in <module>
ImportError: No module named redis

Sample piece of code which give the above error:
public static void main(String[] args) {
        try {
            Properties properties = new Properties();
            properties.setProperty("python.home", "/Users/ranumola/jython2.7.1/");
            properties.setProperty("python.path", "/Users/ranumola/jython2.7.1/Lib");
            properties.setProperty("python.import.site", "false");
            PythonInterpreter.initialize(System.getProperties(), properties, new String[] {""});
            PythonInterpreter python = new PythonInterpreter();
            String script = "# Python3 program to add two numbers \n" + "  \n" + "num1 = 15\n" + "num2 = 12\n" + "  \n" + "# Adding two nos \n"
                    + "sum = num1 + num2 \n" + "  \n" + "# printing values \n" + "print(\"Sum of {0} and {1} is {2}\" .format(num1, num2, sum)) ";
            String script1 = "import sys\n" + "sys.path.append(\"/Users/ranumola/jython2.7.1/Lib\")\n" + "\n" + "import redis\n"
                    + "r = redis.Redis(host='localhost', port=6379)\n" + "r.get('foo')";
            python.set("script", new PyString(script));
            python.exec(script);
            python.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
History
Date User Action Args
2019-10-30 07:40:50rkanumolasetrecipients: + rkanumola
2019-10-30 07:40:50rkanumolasetmessageid: <1572421250.61.0.301210956979.issue2818@roundup.psfhosted.org>
2019-10-30 07:40:50rkanumolalinkissue2818 messages
2019-10-30 07:40:50rkanumolacreate