From: Alan F. <Ala...@sa...> - 2005-07-21 13:15:48
|
Brian, OK, I can see your explanation for the example I sent. I was just trying = to give you an example from the modules that are included with Jython. = However, I am still having this problem with the package I am = developing, and both levels of the 'from' clause do have an __init__.py = file. Is there another explanation for this failing? Will problems in = the __init__.py file be displayed or does it fail silently? On another note, I tried the following in the console: >>> from email.test import test_email Traceback (innermost last): File "<console>", line 1, in ? ImportError: cannot import name test_email >>> from email.test import test_email >>> I noticed that the file 'test_email$py.class' did not exist when the = first command failed, but it appeared after the error message. The = second try it worked. Is there a timeout somewhere that controls this? Thanks, Alan -----Original Message----- From: Brian Zimmer [mailto:bz...@zi...]=20 Sent: Wednesday, July 20, 2005 5:12 PM To: Alan Field Cc: jyt...@li... Subject: Re: [Jython-dev] Problems with import in 2.2a1 I don't think 'from test.zxjdbc import runner' should work since zxjdbc = is not a package, there is no __init__.py file. I do a 'touch __init__.py' in that directory, then it imports=20 correctly. I think this is the correct behaviour. thanks, brian Alan Field wrote: >Hey, > >First off, thanks for all of the hard work to get to this milestone. I = am glad to have something new to work with! > >I am having trouble with two level imports in the newest version. For = example the following type of command works fine in 2.1 but produces = this output in the alpha release: > >Jython 2.2a1 on java1.4.2_04 (JIT: null) >Type "copyright", "credits" or "license" for more information. > =20 > >>>>from test.zxjdbc import runner >>>> =20 >>>> >Traceback (innermost last): > File "<console>", line 1, in ? >ImportError: No module named zxjdbc > =20 > > >Here is an example from 2.1: (The same libraries are not available.) > >Jython 2.1 on java1.4.2_04 (JIT: null) >Type "copyright", "credits" or "license" for more information. > =20 > >>>>from xml.dom import Attr >>>> >>>> =20 >>>> > >If you try to import from the top level, ("from encodings import = cp037") everything is fine. > >Thanks, >Alan > > > > >------------------------------------------------------- >SF.Net email is sponsored by: Discover Easy Linux Migration Strategies >from IBM. Find simple to follow Roadmaps, straightforward articles, >informative Webcasts and more! Get everything you need to get up to >speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id=16492&op=3Dclick >_______________________________________________ >Jython-dev mailing list >Jyt...@li... >https://lists.sourceforge.net/lists/listinfo/jython-dev > =20 > |