Asking for help with code? Post a minimal working example. (was: importing modules dynamicly)

Ben Finney ben+python at benfinney.id.au
Tue Jan 11 07:21:20 EST 2011


Jean-Michel Pichavant <jeanmichel at sequans.com> writes:

> Your code is rather strange, 'modules' looks to be a list or some
> iterable, and then you expect to have a 'modulename' attribute or
> something...

> My guess is that you pasted an approximative translation of your code
> which makes it impossible de debug.

To the OP: It is often a good idea to simplify one's code when asking
for help. That will make it easier to understand.

But don't simplify to the point where the code doesn't actually run, or
doesn't demonstrate the behaviour you're reporting! Instead, post a
minimal working example of the thing you want explained.

To discuss the code and present advice, people will want to run your
code for themselves to see what you're seeing, or as close as they can
get. Make that easier for them by ensuring your example actually does
what you say it does.

-- 
 \           “I prayed for twenty years but received no answer until I |
  `\          prayed with my legs.” —Frederick Douglass, escaped slave |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list