473,387 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

jython import

Been digging and could not find the answer to this.
I'd be very grateful if someone could help.

I can't import a class from a packackge that is nested:
--
import sys
sys.path.append("hsqldb.jar")
import org.hsqldb

print dir(org.hsqldb)
v = org.hsqldb.View()
--
The output is a the dir listing of hsqldb, including View, and the
following error:

File "test.py", line 6, in ?
AttributeError: java package 'org.hsqldb' has no attribute 'View'
Signal 127

51 /testing:
Any idea why this fails? I saw other people with the same problem,
but no reasons or ideas as to how to fix.
Jul 18 '05 #1
2 4473
Kevin Dahlhausen wrote:
Been digging and could not find the answer to this.
I'd be very grateful if someone could help.

I can't import a class from a packackge that is nested:
--
import sys
sys.path.append("hsqldb.jar")
import org.hsqldb

print dir(org.hsqldb)
v = org.hsqldb.View()
--
The output is a the dir listing of hsqldb, including View, and the
following error:

File "test.py", line 6, in ?
AttributeError: java package 'org.hsqldb' has no attribute 'View'
Signal 127

51 /testing:


It should work when the class is public.
Is the View class private or package private in package org.hsqldb?

You can make jython look into java private things by
setting python.security.respectJavaAccessibility to false in
jython's registry:
http://www.jython.org/docs/registry.html

It's better to respect java accessibilty, though.

Regards,
Ype

--
email at xs4all.nl
Jul 18 '05 #2
Thanks. (Had tried both). Turns out I was running into issues
setting the classpath correctly (cygin bash, calling native win java,
it's easy to miss-step when adding paths with spaces).
Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: angel | last post by:
A java runtime environment includes jvm and java class (for example classes.zip in sun jre). Of course jython need jvm,but does it need java class. Thanx
7
by: Jan Gregor | last post by:
Hello I found that jython catches exact java exceptions, not their subclasses. Is there some way to get around this limitation (or error) ? My program has class representing database source...
5
by: Maurice Ling | last post by:
Hi, I have read that this had been asked before but there's no satisfactory replies then. I have a module (pA) written in python, which originally is called by another python module (pB), and...
1
by: Nandan | last post by:
hello, can I ask a jython question here? when I use the jython interpreter I have no problem with the statement: from java import lang from javax import swing but when I put this in a...
12
by: Mark Fink | last post by:
I wrote a Jython class that inherits from a Java class and (thats the plan) overrides one method. Everything should stay the same. If I run this nothing happens whereas if I run the Java class it...
1
by: Mark Fink | last post by:
Hi there, I have a source file FailFixture.py in the folder D:\AUT_TEST\workspace\JyFIT\testutil. Now I want to import the file with "import testutil.FailFixture". Unfortunately I could not...
1
by: Gregor Stich | last post by:
Dear all, I hope my question is here in the right place... What I want to achieve is a communication between Java and Python. We have a pretty strong framework of existing python scripts and...
1
by: nmin | last post by:
Hi. I'm using Jython in combination with Java, webservices and jboss4.0.4. The webservice is implemented in java and creates an PythonInterpreter object which loads the jython scripts. I...
3
by: nmin | last post by:
Hi, I'm using Jython in combination with java. I wrote a jython skript, which calls a function from another jython module called library.py. So, executing the function genData() in skript...
2
by: Felipe De Bene | last post by:
Hi There, I'm trying to run an App I wrote in Python 2.5.2 in Jython 2.2.1 and everything works fine except when I try to import the Standard CPython's cookielib. I know this may sound stupid, I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.