Anonymous
Not applicable
2012-05-17
10:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[resolved] Python code - tJython
Hi,
I am trying to implement a piece of code written in Python in to Talend(TOS). I found a component for this reason tJython but the main point is to interpret the python code to Jython. And the fact is that I am new to Jython. Can someone kindly help me with implementing the code?
this is the Python code:
The code is to transpose a csv file from column to row.
Your help is much appreciated.
Pouya
I am trying to implement a piece of code written in Python in to Talend(TOS). I found a component for this reason tJython but the main point is to interpret the python code to Jython. And the fact is that I am new to Jython. Can someone kindly help me with implementing the code?
this is the Python code:
import csv
from itertools import izip
a = izip(*csv.reader(open("input.csv", "rb")))
csv.writer(open("output.csv", "wb")).writerows(a)
The code is to transpose a csv file from column to row.
Your help is much appreciated.
Pouya
392 Views
1 Solution
Accepted Solutions
Anonymous
Not applicable
2012-05-18
12:32 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm a Python n00b, but I think this means you are trying to import the Java class org.python.core.PyException into Jython. Try adding the class to the classpath variables.
Windows > Preference > Java > Buildpath > Classpath Variables
Windows > Preference > Java > Buildpath > Classpath Variables
392 Views
4 Replies
Anonymous
Not applicable
2012-05-17
05:28 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Pouya,
Did you try the code above? If you did and it didn't work, what was the error you received?
I have not used Jython, but my understanding is that Jython syntax is identical to Python except for using some java specific libraries as collections; it just allows Python to run through the JVM.
This is probably a good reference to get started.
http://www.jython.org/jythonbook/en/1.0/
Best,
Ben
Did you try the code above? If you did and it didn't work, what was the error you received?
I have not used Jython, but my understanding is that Jython syntax is identical to Python except for using some java specific libraries as collections; it just allows Python to run through the JVM.
This is probably a good reference to get started.
http://www.jython.org/jythonbook/en/1.0/
Best,
Ben
392 Views
Anonymous
Not applicable
2012-05-18
09:12 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Ben,
Many thanks for your response.
I created a job so that it emails me when an exception is thrown. And this is the error message I am getting "org.python.core.PyException:null" .
I believe the above code which is a pure Python code must be interpreted for JVM. And that's where Jython comes in which I am not that knowledgeable about.
Thanks for the reference you sent. I will have a look. But in case if the above error code is familiar for you I appreciate your help.
Cheers
Pouya
Many thanks for your response.
I created a job so that it emails me when an exception is thrown. And this is the error message I am getting "org.python.core.PyException:null" .
I believe the above code which is a pure Python code must be interpreted for JVM. And that's where Jython comes in which I am not that knowledgeable about.
Thanks for the reference you sent. I will have a look. But in case if the above error code is familiar for you I appreciate your help.
Cheers
Pouya
392 Views
Anonymous
Not applicable
2012-05-18
12:32 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm a Python n00b, but I think this means you are trying to import the Java class org.python.core.PyException into Jython. Try adding the class to the classpath variables.
Windows > Preference > Java > Buildpath > Classpath Variables
Windows > Preference > Java > Buildpath > Classpath Variables
393 Views
Specialist III
2013-02-05
07:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
x = input()
y = input()
print x/y
392 Views