jython import

Ype Kingma ykingma at accessforall.nl
Sat Feb 14 09:25:22 EST 2004


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



More information about the Python-list mailing list