By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,427 Members | 1,379 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,427 IT Pros & Developers. It's quick & easy.

jython import

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.