jython

Running HtmlUnit with Jython - issue with startup on command line

南楼画角 提交于 2020-01-13 04:48:07
问题 I tried to run HtmlUnit with Jython following this tutorial: http://blog.databigbang.com/web-scraping-ajax-and-javascript-sites/ but it does not work for me. I am unable to import the com.gargoylesoftvare packages, there are only some HTML files in HtmlUnit folder, which I need to import somehow? The tutorial says to run python script like this: /opt/jython/jython -J-classpath "htmlunit-2.8/lib/*" gartner.py and I try to run: java -jar /Users/adam/jython/jython.jar -J-classpath "htmlunit-2.8

Beginner python programming help to crossfade sounds

岁酱吖の 提交于 2020-01-12 09:24:28
问题 Hello I am taking a programming class and I am completely lost with a question. We need to take two sounds and add them together. But the first sound starts of at full volume and the second starts silent and then slowing shifting the balance till the first sound is silent and the second is at full volume. So I was able to put the sounds together but i am not sure how to make them get louder over the course of the sound. def mergeSounds(s1, s2): sr = int(getSamplingRate(s1)) newSound =

Beginner python programming help to crossfade sounds

本秂侑毒 提交于 2020-01-12 09:22:57
问题 Hello I am taking a programming class and I am completely lost with a question. We need to take two sounds and add them together. But the first sound starts of at full volume and the second starts silent and then slowing shifting the balance till the first sound is silent and the second is at full volume. So I was able to put the sounds together but i am not sure how to make them get louder over the course of the sound. def mergeSounds(s1, s2): sr = int(getSamplingRate(s1)) newSound =

trap exceptions comprehensively in Jython

試著忘記壹切 提交于 2020-01-11 11:53:10
问题 This is my attempt so far to trap all exceptions in Jython code. The most difficult thing, I find, is trapping exceptions when you override a method from a Java class: with the "vigil" decorator below (which also tests whether the EDT/Event Despatch Thread status is correct) you can find out the first line where the code is thrown... so you can identify the method itself. But not the line. Furthermore, tracing stack frames back through Python and Java stacks is completely beyond me. Obviously

Can I install Selenium2Library for RobotFramework without installing Python?

独自空忆成欢 提交于 2020-01-11 07:57:07
问题 Can I use Selenium2Library if I only have Jython? That is, I haven't installed Python, and was hoping to get away with not needing it. I've read conflicting information however that jybot CANNOT use selenium2library, and I'll need pybot to use it. If jybot can't use selenium2Library, is there a way to have jybot call pybot somehow? Thanks 回答1: So after some reading and trial and error, it IS possible to use Selenium2Library with only Jython AS LONG AS you use jython 2.7+ ... jython 2.5.x is

Different / better approaches for calling python function from Java

天涯浪子 提交于 2020-01-10 05:18:25
问题 I am quite new to python and am trying to call python's function from java. My primary requirements are these: call should be transparent, in the sense that it should not require modifying .py file simply to enable it to be called from java. I might be given any python file with some functions inside it. I should be able to call any of these functions without requiring to modify .py file. I want to be able to send arguments of both primitive types ( int , String , floats etc.) or non

How to add external jar files to grinder project

谁说胖子不能爱 提交于 2020-01-07 03:12:22
问题 I am new to Grinder load testing framework. I recorded a grinder script using tcpproxy. And then I made some modifications which includes use of external jar files. In eclipse using grinder plugin I added a dependency for those jar files. But how do I setup similar stuff using command line - assuming I dont have eclipse available to me.. Do I have to add anything in grinder.properties ? Thanks 回答1: you can add external jar file using properties file. You have to use grinder.jvm.classpath

Python Interpreter in Jython

徘徊边缘 提交于 2020-01-06 19:52:15
问题 All I'm trying to do is pass an argument to the python interpreter so it can be passed as an argument for a module. E.g. I have the following defined in a py file: def print_twice(test): print test print test I want to pass it the argument "Adam", so I've tried: // Create an instance of the PythonInterpreter PythonInterpreter interp = new PythonInterpreter(); // The exec() method executes strings of code interp.exec("import sys"); interp.exec("print sys"); PyCode pyTest = interp.compile("Adam

Python Interpreter in Jython

僤鯓⒐⒋嵵緔 提交于 2020-01-06 19:52:09
问题 All I'm trying to do is pass an argument to the python interpreter so it can be passed as an argument for a module. E.g. I have the following defined in a py file: def print_twice(test): print test print test I want to pass it the argument "Adam", so I've tried: // Create an instance of the PythonInterpreter PythonInterpreter interp = new PythonInterpreter(); // The exec() method executes strings of code interp.exec("import sys"); interp.exec("print sys"); PyCode pyTest = interp.compile("Adam

How to run python in java

一世执手 提交于 2020-01-06 04:17:25
问题 How to run file* .py * in your Java program without using Jython? For example: I have JButton and I want to run python script when I click on the JButton. What should I put in Action Preformed for the button to run python script without using Jython? 回答1: You need to have the python interpreter installed in the machine where you want to do that and call this interpreter as an external command from Java. Look at this question to know more about how perform that call: Execute external program