Search Results

Search found 141 results on 6 pages for 'jython'.

Page 1/6 | 1 2 3 4 5 6  | Next Page >

  • Jython project in Eclipse can't find the Jython library, but works in an identical project

    - by Rob Lourens
    I have two projects in Eclipse with Java and Python code, using Jython. Also I'm using PyDev. One project can import and use the xml module just fine, and the other gives the error ImportError: No module named xml. As far as I can tell, all the project properties are set identically. The working project was created from scratch and the other comes from code checked out of an svn repository and put into a new project. What could be the difference?

    Read the article

  • Jython webapp performance

    - by DrPep
    I'm currently building a Jython web app but am concerned about Jython application performance. I take some comfort in that any compute intensive tasks I can write in a separate Java jar and invoke them from Jython. Has anyone had problems doing this, or forsee issues with such a setup?

    Read the article

  • How to import your own non-packaged Java classes in Jython

    - by thepandaatemyface
    I know in Jython you can do import java.util.Random as Random Random().nextInt() But if I have a class I wrote myself, how can I import it into Jython without putting the class itself in a package? If I have a testclass Test: public class Test { public void foo() { System.out.println("bar"); } } that's not inside a package. Can I even import that into jython by using something along the lines offrom Test import Test?

    Read the article

  • Is there a good NumPy clone for Jython?

    - by jbrogdon
    I'm a relatively new convert to Python. I've written some code to grab/graph data from various sources to automate some weekly reports and forecasts. I've been intrigued by the Jython concept, and would like to port some Python code that I've written to Jython. In order to do this quickly, I need a NumPy clone for Jython (or Java). Is there anything like this out there?

    Read the article

  • Java converting to Jython-Getting a class object within itself

    - by Bggreen
    I am attempting to convert Java code to Jython and am using the apache Log and LogFactory imports. I am attempting to emulate Foo.class in Jython The chunk of code is as follows: in Java import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class MyClass { private static final Log log = LogFactory.getLog(MyClass.class); public MyClass(Document dom) { //code } How can I emulate this same behavior of MyClass.class in Jython/Python?

    Read the article

  • Migrating from CPython to Jython

    - by itsadok
    I'm considering moving my code (around 30K LOC) from CPython to Jython, so that I could have better integration with my java code. Is there a checklist or a guide I should look at, to help my with the migration? Does anyone have experience with doing something similar? From reading the Jython site, most of the problems seem too obscure to bother me. I did notice that: thread safety is an issue Unicode support seems to be quite different, which may be a problem for me mysqldb doesn't work and needs to be replaced with zxJDBC Anything else? Related question: What are some strategies to write python code that works in CPython, Jython and IronPython

    Read the article

  • Calling Python from Java through scripting engine (jython)?

    - by griffin
    I'm trying to call Jython from a Java 6 application using javax.script: import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; import javax.script.ScriptException; public class jythonEx { public static void main (String args[]) throws ScriptException { ScriptEngineManager mgr = new ScriptEngineManager(); ScriptEngine pyEngine = mgr.getEngineByName("python"); try { pyEngine.eval("print \"Python - Hello, world!\""); } catch (Exception ex) { ex.printStackTrace(); } } } This is causing a NullPointerException: java.lang.NullPointerException at jythonEx.main(jythonEx.java:12) Does anyone have any idea what I'm doing wrong here? Edit: Thanks for the responses! I added jython.jar to the classpath and it runs properly: java -cp "./;jython.jar" jythonEx

    Read the article

  • ImportError: No module named optparse in jython

    - by jeet
    getting Traceback (most recent call last): File "C:\projects\myproject\convert.py", line 139, in import optparse ImportError: No module named optparse. when executing it using jython. Same module works fine when i execute it through python. I am usinng window7 operating system. The same modle works fine on windows XP machine with both python and Jython.

    Read the article

  • Using JRuby/Jython for Ruby/Python interoperability?

    - by dbr
    Quite-probably a silly question, as I don't know much about Java/Jython/JRuby/bytecode, but.. I stumbled across _why's unholy again today.. It allows you to output Python bytecode from Ruby code.. Basically allowing them to produce the same bytecode.. Jython outputs Java bytecode, as does JRuby.. Since these both compile to the same bytecode, does this mean you could potentially use any Python library from Ruby, and Ruby libraries from Python?

    Read the article

  • IDE for websphere/jython

    - by int
    I would like to develop administrative jython-scripts for WebSphere 7. Is there any IDE (or may be plugins for eclipse) which provides code auto-completition functions, ability to start/stop server, debug jython scripts? I know that there is the Application Server Toolkit 6.1 but it is for WebSphere 6.1 and couldn't be applied to WebSphere 7.

    Read the article

  • Best resources for starting Jython

    - by Eric Wendelin
    I just got my first Jython (and Python) project, and I was wondering what documentation, IDEs, etc. are best suited to a Java buff like me. I know there are a lot of questions about starting out with Python, so I'm asking for things that might be specific to Jython. Where should I start? If it helps, I'm running Linux and Solaris only.

    Read the article

  • How to load a springframework ApplicationContext from Jython

    - by staticman
    I have a class that loads a springframework application context like so: package com.offlinesupport; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class OfflineScriptSupport { private static ApplicationContext appCtx; public static final void initialize() { appCtx = new ClassPathXmlApplicationContext( new String[] { "mycontext.spring.xml" } ); } public static final ApplicationContext getApplicationContext() { return appCtx; } public static final void main( String[] args ) { System.out.println( "Starting..." ); initialize(); System.out.println( "loaded" ); } } The class OfflineScriptSupport, and the file mycontext.spring.xml are each deployed into separate jars (along with other classes and resources in their respective modules). Lets say the jar files are OfflineScriptSupport.jar and *MyContext.jar". mycontext.spring.xml is put at the root of the jar. In a Jython script (*myscript.jy"), I try to call the initialize method to create the application context: from com.offlinesupport import OfflineScriptSupport OfflineScriptSupport.initialize(); I execute the Jython script with the following command (from Linux): jython -Dpython.path=spring.jar:OfflineScriptSupport.jar:MyContext.jar myscript.jy The Springframework application context cannot find the mycontext.spring.xml file. It displays the following error: java.io.FileNotFoundException: class path resource [mycontext.spring.xml] cannot be opened because it does not exist at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:137) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:167) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:148) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:126) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:142) at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113) at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:81) at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:89) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:269) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:87) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:72) at com.offlinesupport.OfflineScriptSupport.initialize(OfflineScriptSupport.java:27) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) If I run the jar directly from Java (using the main entry point in OfflineScriptSupport) it works and there is no error thrown. Is there something special about the way Jython handles classpaths making the Springframework's ClassPathXmlApplicationContext not work (i.e. not be able to find resource files in the classpath)?

    Read the article

  • Jython saying "No visible constructors for class"

    - by clutch
    I have a jython servlet as part of a large application running in tomcat5. I tested a few Spring Framework classes and create the objects in the Jython servlet. When I try to create objects of classes in the application I catch an Exception message "No visible constructors for class". These java classes do have a public constructor class, such as: public SchoolImpl() { } I create the object in python: from com.dc.sports.entity import SchoolImpl ... school = SchoolImpl() What am I doing wrong?

    Read the article

  • call a jython file from another program

    - by kdev
    Hi everyone, can i call a jython file from another jython program and execute that . Also i know os.system(cmd.exe)get the system prompt . is it possible that i can trigger cmd.exe and cmd.exe gets poped up into the screen. Thanks

    Read the article

  • Jython 2.5.1: "ImportError: No Module named os"

    - by Leonidas
    I looked through the other posts and bug reports and couldn't figure out what's causing this. I'm using Jython 2.5.1, in a Java project in Eclipse (Ubuntu 8.10). It has been added to the project as a standalone .jar file (I just replaced the old Jython 2.1 jar with this one). I'm running a script that uses the threading.py class. At some point the statement "import os" is evaluated from linecache.py and I get this error, which I can't seem to figure out how to fix: 'Execution failed. Traceback (most recent call last): File "<string>", line 1, in <module> File "../lib/python/threading.py", line 6, in <module> import traceback File "../lib/python/traceback.py", line 3, in <module> import linecache File "../lib/python/linecache.py", line 9, in <module> import os ImportError: No module named os'

    Read the article

  • Sorting list of URLs by length in Jython

    - by Eef
    Hi, I am writing a Jython script to sort a list of URLs. I have a list that looks like this: http://www.domain.com/folder1/folder2/|,1 http://www.domain.com/folder1/|,1 http://www.domain.com/folder1/folder2/folder3/|,1 http://www.domain.com/folder1/|,1 http://www.domain.com/folder1/folder2/|,1 http://www.domain.com/folder1/folder2/|,1 http://www.domain.com/folder1/folder2/folder3/|,1 The pipe and the comma separates the path from the amount of files that are under that path. Is it possible some how use Jython to order the URLs by length, so it would end up look like the below list: http://www.domain.com/folder1/|,1 http://www.domain.com/folder1/|,1 http://www.domain.com/folder1/folder2/|,1 http://www.domain.com/folder1/folder2/|,1 http://www.domain.com/folder1/folder2/|,1 http://www.domain.com/folder1/folder2/folder3/|,1 http://www.domain.com/folder1/folder2/folder3/|,1 Hope you guys get what I mean, any help would be appreciated. Cheers

    Read the article

  • A Question about using jython when run a receving socket in python

    - by abusemind
    Hi, I have not a lot of knowledge of python and network programming. Currently I am trying to implement a simple application which can receive a text message sent by the user, fetch some information from the google search api, and return the results via text message to the user. This application will continue to listening to the users messages and reply immediately. How I get the text short message sent by the user? It's a program named fetion from the mobile supplier in China. The client side fetion, just like a instant communication tool, can send/receive messages to/from other people who are using mobile to receive/send SMS. I am using a open source python program that simulates the fetion program. So basically I can use this python program to communate with others who using cell phone via SMS. My core program is based on java, so I need to take this python program into java environment. I am using jython, and now I am available to send messages to users by some lines of java codes. But the real question is the process of receving from users via SMS. In python code, a new thread is created to continuously listen to the user. It should be OK in Python, but when I run the similar process in Jython, the following exception occurs: Exception in thread Thread:Traceback (most recent call last): File "D:\jython2.5.1\Lib\threading.py", line 178, in _Thread__bootstrap self.run() File "<iostream>", line 1389, in run File "<iostream>", line 1207, in receive File "<iostream>", line 1207, in receive File "<iostream>", line 150, in recv File "D:\jython2.5.1\Lib\select.py", line 223, in native_select pobj.register(fd, POLLIN) File "D:\jython2.5.1\Lib\select.py", line 104, in register raise _map_exception(jlx) error: (20000, 'socket must be in non-blocking mode') The line 150 in the python code is as follows: def recv(self,timeout=False): if self.login_type == "HTTP": time.sleep(10) return self.get_offline_msg() pass else: if timeout: infd,outfd,errfd = select([self.__sock,],[],[],timeout)//<---line 150 here else: infd,outfd,errfd = select([self.__sock,],[],[]) if len(infd) != 0: ret = self.__tcp_recv() num = len(ret) d_print(('num',),locals()) if num == 0: return ret if num == 1: return ret[0] for r in ret: self.queue.put(r) d_print(('r',),locals()) if not self.queue.empty(): return self.queue.get() else: return "TimeOut" Because of I am not very familiar with python, especially the socket part, and also new in Jython use, I really need your help or only advice or explanation. Thank you very much!

    Read the article

  • Jython java call throws exception asking for 2 args when only one arg is coded

    - by clutch
    I have an Java method I want to call within my Jython servlet running on tomcat5. It looks like this: @SuppressWarnings("unchecked") public School loadByName(String name) { List<School> school; school = getHibernateTemplate().find("from " + getPersistentClass().getName() + " where name = ?", name); return uniqueResult(school); } I call it in Jython using: foobar = SchoolDAOHibernate.loadByName('Univeristy') It throws an error that says loadByName() expects 2 args; got 1. What other argument could it be looking for?

    Read the article

  • How do I get the username in Java (ie, who -m in Java) (or Jython 2.1)

    - by amertune
    Here's the situation. I have a jython 2.1 script in a shared account that needs to know who is calling it. In bash, I can simply use 'who -m' and it will give me the correct username. I haven't been able to find anything in java (or jython) that would give me a similar result. Even trying to call Runtime.getRuntime().exec("who -m") doesn't do anything. When I try to read the InputStream from the process returned by exec, the stream is empty.

    Read the article

  • Saving a movie generated with Jython/JES on local disk

    - by Golgauth
    I made an autogenerated movie clip using JES (Jython Environment for Students). I can play it without any problem using playMovie(), but I can't figure out how to have it saved physically on disk. The full script is located here. ... movie = synthesizeFrameAndCreateMovie("D:\\FOLDER") print movie writeQuicktime(movie,"D:\\FOLDER\\movie.mov", 30) [LINE 35] #playMovie(movie) I get this error when calling the function writeQuicktime(): >>> ======= Loading Progam ======= Movie, frames: 60 The error was: Index: 0, Size: 0 I wasn't able to do what you wanted. The error java.lang.IndexOutOfBoundsException has occured Please check line 35 Note : I also tried the function writeAVI(), with the exact same result. This error sounds like a java bug in Jython/JES library. I am running JES under Windows 7 and have all the common Quicktime and AVI codex installed as well as the QTjava library in my jre... Any brilliant idea ? EDIT : Also tried the Linux version with same result for both QuickTime and AVI...

    Read the article

  • Jython & Mysql - what is the current practice for connection?

    - by Sector7B
    Just trying jython for the first time, because something came up at work that would fit for this perfect for it. I assume jython can make mysql jdbc connection using the mysql jdbc driver. After googling and reading, however I am having problems and it seems jython specific and probably simple. so i do jython: Jython 2.5.1 (Release_2_5_1:6813, Sep 26 2009, 13:47:54) [Java HotSpot(TM) 64-Bit Server VM (Apple Inc.)] on java1.6.0_17 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> print sys.path ['', '/JYTHONPATH/mysql-connector-java-5.1.10-bin.jar', '/WorkArea/Apps/jython/jython2.5.1/Lib', '__classpath__', '__pyclasspath__/', '/WorkArea/Apps/jython/jython2.5.1/Lib/site-packages'] >>> code i'm running from java.lang import * from java.sql import * driverName="com.mysql.jdbc.Driver" Class.forName(driverName) url = "jdbc:mysql://localhost/test?user=jgreenaw&password=" con = DriverManager.getConnection(url) stmt = con.createStatement() output riux:Desktop$ jython pymysql.py Traceback (most recent call last): File "pymysql.py", line 7, in <module> Class.forName(driverName) at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:315) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330) at java.lang.ClassLoader.loadClass(ClassLoader.java:250) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) java.lang.ClassNotFoundException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver any advice? thanks

    Read the article

  • Jython and python modules

    - by Geo
    I've just started using the PythonInterpreter from within my Java classes, and it works great! However, if I try to include python modules (re, HTMLParser, etc.), I'm receiving the following exception (for re): Exception in thread "main" Traceback (innermost last): File "", line 1, in ? ImportError: no module named re How could I make the classes from the jython jar "see" the modules python has available?

    Read the article

  • running jython bytecode using java

    - by noamtm
    It looks like I'm missing something. When using Jython to run my Python code in Java, Java bytecode files are generated (test.py - [email protected]). Can I run these classes directly using java? In other words, I want to make this: $ java test@py [additional cp args] work. The intent: writing Python code and not having to give away source code.

    Read the article

1 2 3 4 5 6  | Next Page >