Re: [Tutor] using dynamic import statements

2012-07-09 Thread wolfrage8...@gmail.com
Might I recommend you use the logging module that is part of core Python rather than rolling your own if Debug. I found the logging module made growing my logging across multiple applications so easy! http://docs.python.org/library/logging.html On Mon, Jul 9, 2012 at 2:10 PM, Chris Hare wrote: >

Re: [Tutor] using dynamic import statements

2012-07-09 Thread Chris Hare
Thanks all for the ideas. I wanted to have my own error messages printed for the user - something a little more meaningful than the standard error. Thanks for the advice - very helpful! On Jul 9, 2012, at 6:12 AM, Alan Gauld wrote: > On 09/07/12 10:19, Kwpolska wrote: >> Why does this bloody

Re: [Tutor] using dynamic import statements

2012-07-09 Thread Alan Gauld
On 09/07/12 10:19, Kwpolska wrote: Why does this bloody ML want me to respond to the last person instead of tutor@python.org? Because that's how it, along with many other mailing lists, works. If it helps, think of it as you receiving a mail from the sender and CCd to the list. Therefore hitti

Re: [Tutor] using dynamic import statements

2012-07-09 Thread Kwpolska
Why does this bloody ML want me to respond to the last person instead of tutor@python.org? --- On Mon, Jul 9, 2012 at 9:47 AM, Alan Gauld wrote: > On 09/07/12 02:10, Chris Hare wrote: >> >> >> Here is what I want to do: >> >> I have a bunch of modules to import. instead of duplicating > >> a lot o

Re: [Tutor] using dynamic import statements

2012-07-09 Thread ankur ~ अंकुर
On Mon, Jul 9, 2012 at 6:40 AM, Chris Hare wrote: > > Here is what I want to do: > > I have a bunch of modules to import. instead of duplicating a lot of code > for each import, I want to do something like this: > > importList = [ "sys", "os", "imp", "stat", "re", "webbrowser", "Image", > "Strin

Re: [Tutor] using dynamic import statements

2012-07-09 Thread Alan Gauld
On 09/07/12 02:10, Chris Hare wrote: Here is what I want to do: I have a bunch of modules to import. instead of duplicating > a lot of code for each import, I want to do something like this: ...lots of code stripped Why not the more usual: import sys, os, imp, stat,\ re, web

Re: [Tutor] using dynamic import statements

2012-07-09 Thread Hugo Arts
On Mon, Jul 9, 2012 at 3:10 AM, Chris Hare wrote: > > Here is what I want to do: > > I have a bunch of modules to import. instead of duplicating a lot of code > for each import, I want to do something like this: > > importList = [ "sys", "os", "imp", "stat", "re", "webbrowser", "Image", > "Strin

[Tutor] using dynamic import statements

2012-07-08 Thread Chris Hare
Here is what I want to do: I have a bunch of modules to import. instead of duplicating a lot of code for each import, I want to do something like this: importList = [ "sys", "os", "imp", "stat", "re", "webbrowser", "Image", "StringIO", "shutil", "datetime" ] for object in importList: