Message1656

Author cookconsulting
Recipients
Date 2007-06-27.00:22:32
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
/* 
First time posting an error report here, so hope this helps. Otherwise, I love Jython!

error detailed inline
 attached file from the PythonCookbook:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/298721/index_txt
 NOTE: the file works from the command prompt Python interpreter

*/

/**
 * User: tcook
 * Date: Jun 25, 2007
 */

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.BasicConfigurator;
import org.python.util.PythonInterpreter;
import org.python.core.PyInteger;
import org.python.core.PyObject;
import org.python.core.PyString;

import java.util.Properties;

public class JythonTest
{
    private static Log log = LogFactory.getLog(JythonTest.class);

    public static void main(String[] args)
    {
        try
        {
            // Set up a simple configuration that logs on the console.
            BasicConfigurator.configure();
            System.out.println("Jython Test ");

            // to find modules, they must be pushed into the path
            Properties props = new Properties();
            props.setProperty("python.path", "/users/tcook/Documents/pythonScripts/");
            PythonInterpreter.initialize(System.getProperties(), props, new String[]{""});
            PythonInterpreter interp = new PythonInterpreter();
            try
            {
                interp.exec ( "import xml2obj2 as xml2obj" ) ;
                /// xml2obj2.py exists in  /users/tcook/Documents/pythonScripts/

                //error is:
//                Jython Test 
//                Traceback (innermost last):
//                  File "<string>", line 1, in ?
//                  File "/users/tcook/Documents/pythonScripts/xml2obj2.py", line 138
//                                yield oChild
//                                                  ^
//                SyntaxError: invalid syntax
                

                // other stuff was planned, but it blows up...
                // note other programs and evaluation work in this same setup....


            } catch (Exception e)
            {
                e.printStackTrace();
            }
        }
        catch (Exception e)
        {
            log.error(e);
        }
    }

}
History
Date User Action Args
2008-02-20 17:17:51adminlinkissue1743933 messages
2008-02-20 17:17:51admincreate