> Ok, that makes sense - is there a particular reason why jython doesn't
> have a custom classloader to which add_* adds extra paths? Or is just
> that no one has gotten around to it yet? =)
>
You should consider that the add_ family generalize from add_package
(the desire would be to make it's usage very rare, but in reality
we needed generalizations too), which is about informing jython
about loadable packages not about setting up classloaders ...
So what would seems natural in the add_extdir,etc perspective,
it is not in the general (add_package).
regards, Samuele.

I have a jar setup containing all of jython/Lib (*.py and all
pre-byte-compiled *$py.class). I pass in a "-Dpython.path=my.jar!Lib",
and imports work fine for all the modules in the main Lib directory (e.g.
glob), but if I try and import something in a nested directory (e.g.
Lib/pawt) I get an ImportError. Any ideas? Thanks,
Matt

Ok, that makes sense - is there a particular reason why jython doesn't
have a custom classloader to which add_* adds extra paths? Or is just
that no one has gotten around to it yet? =)
Matt
On 10/26/2001 06:35:00 PM "Robert W. Bill" wrote:
>
> Yes, the add_* methods (add_classdir, add_extdir, add_package) are a bit
> tricky because they do not make classes available to Jython, they just
> give the packageManager some hints to make the packages available. The
> classloader still must find the class in the classpath

On Fri, 26 Oct 2001 Matt_Conway@... wrote:
> Ahh, ok, that worked, thanks.
> Actually - that also fails if my jar isn't in my classpath when I start
> jython, and I use sys.add_extdir() to add the dir containing my jar.
>
> Matt
Yes, the add_* methods (add_classdir, add_extdir, add_package) are a bit
tricky because they do not make classes available to Jython, they just
give the packageManager some hints to make the packages available. The
classloader still must find the class in the classpath
-robert
> On 10/26/2001 08:19:32 PM jython-users-admin wrote:
> >
> > Import should work with classes that are not in a package. If class
> "foo"
> > has no package statement and is in the classpath, then "import foo"
> should
> > work.
>
>
> _______________________________________________
> Jython-users mailing list
> Jython-users@...
> https://lists.sourceforge.net/lists/listinfo/jython-users
>

Ahh, ok, that worked, thanks.
Actually - that also fails if my jar isn't in my classpath when I start
jython, and I use sys.add_extdir() to add the dir containing my jar.
Matt
On 10/26/2001 08:19:32 PM jython-users-admin wrote:
>
> Import should work with classes that are not in a package. If class
"foo"
> has no package statement and is in the classpath, then "import foo"
should
> work.

On Fri, 26 Oct 2001 Matt_Conway@... wrote:
> How does one import the default java package - i.e. I want to use a class
> in the jython interpreter that has no package name.
>
> Matt
> matt_conway@...
Import should work with classes that are not in a package. If class "foo"
has no package statement and is in the classpath, then "import foo" should
work.
-robert

Andres Corrada-Emmanuel wrote:
> I didn't know about the jython switch. I'd rather set the
> switch and avoid having to write wrapper classes. I was beginning to
> despair that Jython was not up to the task. This is awesome!
>
This is very newbie :) , without offense.
I would not consider the python.respectJavaAccessibility option a
production option, while handy it is more a testing option,
in particular not a newbie option.
It should be noted that under some security settings it will not work
and in some applicative context it can cause security troubles ...
Anyway in your case this could be just irrelevant, I'm lacking the
context information to assess this.
regards, Samuele Pedroni.

Hi Robert,
Thank you. I didn't know about the jython switch. I'd rather set the
switch and avoid having to write wrapper classes. I was beginning to
despair that Jython was not up to the task. This is awesome!
Andres Corrada-Emmanuel
Senior Research Fellow
Center for Intelligent Information Retrieval
University of Massachusetts, Amherst
On Thu, 25 Oct 2001, Robert W. Bill wrote:
>
> The package statement does not ensure that access occurs from this class.
> Creating 'dynamicism' means using indirection. Jython's indirection
> means that the attribute request may not originate in the class found
> in the generated .java file.
>
> > My Python class tries to access a package-accesible super attribute but
> > fails. If I make that attribute public it succeeds. This is
> > unsatisfactory. I'm trying to use someone elses code and I cannot change
> > the attribute properties.
> >
> > Can I still use Jython or do I need to abandon this line of approach and
> > resign myself to having to program in Java directly?
>
> Yes. You can set python.respectJavaAccessibility to false and use Jython.
> Even if you do not do so, you do not have to abandon Jython. Instead,
> write only a wrapper class in java that makes access
> Jython-friendly, then go about the project in Jython.
>
> -robert
>
>