[Tutor] Solved! was Re: help needed with using exec

André Roberge andre.roberge at ns.sympatico.ca
Fri Nov 12 01:08:08 CET 2004


André Roberge wrote:

 > Dear Tutors,
 >
 > Suppose I have in file test.py a single line:
 > move()
 >

[snip]
I was doing as Kent was suggesting below (I just wasn't explaining it well).

The problem was that my test file move did NOT contain only
one line but was as follows:
---begin--
move()


---end--
i.e. it had two blank lines tagged at the end.

When I tried to reproduce my problem with 4 short interconnected 
programs (as is the case in my complete program), including
a test.py file with only ONE line ... I couldn't do it.

Two hours later, by removing functions after functions from
my bigger app, converting it from a wxPython GUI application
to simpler scripts ... I eventually reduced it to something
identical to the short 4 scripts mentioned in the paragraph
above.

So.... the only thing left to look at was the file test.py....
Sure enough....

I'm reporting this to the list in the hope that it might help
someone else, sometime...

=========== Kent wrote:

what about this?
move = instance.move
exec code

If that doesn't work, please post a short, complete program and the 
exact error message you are getting when you run it.

Kent


More information about the Tutor mailing list