module name errors (trying to import curses functions from modules as needed) 
Author Message
 module name errors (trying to import curses functions from modules as needed)

I use some very simple curses functions with python 1.5.2.  I don't
have a problem with curses per se.

I use the old top level setup code shown in Andrew Kuchling's early
curses HOWTO.  It works well.

But ...
I want to keep all my various curses input and output functions in
separate modules, calling them when needed, instead of defining them
all at the top of my main program.

If I include top level curses setup code in each module, they import
with no problem.  I call them with the desired parameters and they do
their job.

The real problem is that when a function imported with one module
finishes, so does curses (albeit briefly).

Then of course the screen flashes annoyingly (very briefly) before the
next module once again reactivates curses.

If I try to omit the curses top level setup in the modules and put it
in my main program, of course Python complains about things such as
"stdscr" name errors.  This makes sense, but I don't know how to work
around it.

I can of course finish my program, putting up with the brief screen
flashes, and when finished, pull all my function definitions into my
main program.

If there's a better way, I would be grateful for advice on same.



Thu, 10 Mar 2005 18:42:06 GMT  
 [ 1 post ] 

 Relevant Pages 

1. import curses -> no module named curses

2. Import Error: no module named Java

3. Import Error: No module named ...

4. Need to create module with virtual functions to mirror another module

5. ??? module function in the interface of a module function

6. Error when using curses.wrapper modules

7. How to access a module's namespace within the module at import

8. import selected module variables within that module's procedures

9. need advanced curses module

10. importing module from two packages with the same name

11. Lazy imports (was Re: module naming) (now hopefully correct)

12. Lazy imports (was Re: module naming) (corrected version)


Powered by phpBB® Forum Software