Re: Big problem fetching members from dynamically loaded module

2005-06-26 Thread Philippe C. Martin
> My French is mostly read-only, so let me rephrase: Thank you :-) > from module import *, try ... except, eval(), exec all work together to > make your program harder to understand and more likely to fail in obscure > ways. What would you suggest then, I just want my code to 1) be sturdy 2) some

Re: Big problem fetching members from dynamically loaded module

2005-06-25 Thread Peter Otten
Philippe C. Martin wrote: > Any clue would be quite welcome. I didn't recognize the pattern in the code you posted, but sometimes the order of imports matters: $ find . . ./package ./package/beta.py ./package/alpha.py ./package/__init__.py $ python Python 2.3.3 (#1, Feb 5 2005, 16:22:10) [GCC 3

Re: Big problem fetching members from dynamically loaded module

2005-06-25 Thread Peter Otten
Philippe C. Martin wrote: > OK Peter, first of all thanks. > > You seem to be German and although I leave in the states, I'm French and > your english is clearly far more advanced than mine: I have yet to > understand a few of your comments ;-) My French is mostly read-only, so let me rephrase:

Re: Big problem fetching members from dynamically loaded module

2005-06-25 Thread Philippe C. Martin
I meant live, not leave ! (this is getting pretty bad) Philippe C. Martin wrote: > OK Peter, first of all thanks. > > You seem to be German and although I leave in the states, I'm French and > your english is clearly far more advanced than mine: I have yet to > understand a few of your comments

Re: Big problem fetching members from dynamically loaded module

2005-06-25 Thread Philippe C. Martin
OK Peter, first of all thanks. You seem to be German and although I leave in the states, I'm French and your english is clearly far more advanced than mine: I have yet to understand a few of your comments ;-) > Care to provide the traceback? Traceback (most recent call last): File "SC_Shell.py

Re: Big problem fetching members from dynamically loaded module

2005-06-25 Thread Peter Otten
Philippe C. Martin wrote: > l = inspect.getmembers(eval('BC')) #THIS CRASHES - the class exists Care to provide the traceback? > In [23]:from SC.CARDS.BC import * > > In [24]:l = inspect.getmembers(eval('BC')) What happened in lines 1 through 22? My guess would be In [13]:from SC.CARDS import

Re: Big problem fetching members from dynamically loaded module

2005-06-25 Thread Philippe C. Martin
Hi, I found the solution to my problem: Besides the fact I still have no clue as to how the Python name spacing works, the code I though did stuff (the __EXEC_LIST loop) did not do as I expected as I had already imported all of the modules in an explicit manner. So now I can rephrase my problem:

Re: Big problem fetching members from dynamically loaded module

2005-06-25 Thread Philippe C. Martin
Hi, Hopefully to make things clearer: this works from a shell: In [23]:from SC.CARDS.BC import * In [24]:l = inspect.getmembers(eval('BC')) #l will get all members from class 'BC' whereas the code referenced below gets an exception saying 'BC' is not defined. Thanks, Philippe Philippe C.