From: Leo U. <leo...@ya...> - 2005-08-10 16:04:26
|
I feel 95% certain at this juncture that what I was/am seeing is *normal* jython behavior. class leoSwingFrame imports SwingMacs at the top of the file class SwingMacs import leoSwingFrame at the import of SwingMacs, leoSwingFrame has not fully executed... the classes do not exist. Therefore SwingMacs cannot see those classes. an another example: testimport.py testimport2.py --each contains multiple classes testimport.py imports testimport2 testimport2.py imports testimport when testimport imports testimport2 its classes have not executed. The same situation occurs, testimport2 cannot see the testimport classes because thery are not there yet. But it does appear when everything has executed, they do appear. This behavior is the same in Python and Jython. confusing, well yes :D... but it's reality. A python user probably has to keep in mind, if it has not executed, it is not there yet. I dont know if this explains the other import problems reported, Im going to assume not at this point. gotta run! leouser Leo User <leo...@ya...> wrote: Hi! I would but after some further investigation, Im not sure it is Jython's fault in this case. An example: module testimport.py: class test1( java.lang.Object ): ...pass class test2( java.lang.Object ): ...pass class test3( java.lang.Object ): ...pass import testimport dir( testimport ) [ all the classes are there! ] ------- Im starting to suspect strongly that what Im seeing is not a Jython import bug but a load dependency bug within jyleo's code. For example, in a Jython prompt: >>>import leoSwingFrame #leoSwingFrame was the offending module yesterday ...lots of gibberish ...NullPointerException tossed. in SwingMacs.py at the top of the import section, we have these lines import leoSwingFrame print leoSwingFrame #yes its a module print dir( leoSwingFrame ) #--- >>> hmmm no leoSwingTree, no leoSwingLog, etc.... #no NullPointerException tossed, as in the jython prompt... moving this into the constructor of the SwingMacs class: import leoSwingFrame print leoSwingFrame # yes its a module print dir( leoSwingFrame ) # -- >>> hmmm.... everything is there... something smells funny in jyleo land.... #looks like I can now fully reference the classes, that's weird.... Ill be doing some more testing of this in the coming days. If I can pinpoint it to jython Ill post a bug report. leouser brian zimmer <bz...@zi...> wrote: Can you open a bug at sourceforge so this can be tracked. I am fixing a couple of other import issues. Is this pure python or are you mixing Java and python classes in the module? thanks, brian > howdy Jython Makers, > > I didn't see a bug on this, but I wanted to run this down with you folks > before I entered one. Today I was trying to import a module that has 3 + > classes defined within it. I could import the module and see all of its > attributes but no classes! Hence in the importing module I could not > import the class I was trying to work with. Stranger yet, with another > module that had 1 class defined within it, I could import it and get at > the 1 class. > > so: > dir( module_with_many_classes ) > [ many things, but no classes ] > > dir( module_with_one_class ) > [ one class ] > > Thankfully this has not caused the existing codebase to crash when > running. After persuing the other import emails on this thread, I didn't > see any exact similarity between what I saw and what they were reporting. > > Thanks! > leouser > > > > --------------------------------- > Start your day with Yahoo! - make it your home page __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |