<HTML >
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">



<META content="MSHTML 6.00.2900.3132" name=GENERATOR></HEAD>
<BODY >
<DIV>
<DIV><FONT face=Arial size=2><SPAN class=430403415-20072007>Does anybody know 
how to pass parameters to 'exec 
somefunction.func_code'?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=430403415-20072007></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=430403415-20072007>def 
f1():</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=430403415-20072007>    
print 'this is f1'</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=430403415-20072007></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=430403415-20072007>def 
f2(p):</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=430403415-20072007>    
print 'this is f2, p =', str(p)</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=430403415-20072007></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=430403415-20072007>exec 
f1.func_code</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=430403415-20072007>THIS RESULTS 
IN:  "this is nf1"   WHICH IS NICE</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=430403415-20072007></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=430403415-20072007>exec 
f2.func_code</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=430403415-20072007>THIS RESULTS 
IN:  TypeError: f2() takes exactly 1 argument (0 given)    
WHICH IS EXPECTED</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=430403415-20072007></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=430403415-20072007>exec f2.func_code in 
{'p':34}</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=430403415-20072007>THIS RESULTS 
IN:  TypeError: f2() takes exactly 1 argument (0 given)    
?????</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=430403415-20072007></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=430403415-20072007></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=430403415-20072007>Why?  So I can 
take a function defined in a script or repl and a parameter, marshal 
them, send the results to a remote host, unmarshal them, and execute the 
function given the parameter.  Am I going about this wrongly?  I'd 
specifically like to avoid having to save the function in a file, send the file 
and import it on the remote side.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=430403415-20072007></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=430403415-20072007>thanks!</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=430403415-20072007>Colin</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=430403415-20072007></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=430403415-20072007></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=430403415-20072007></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=430403415-20072007></SPAN></FONT> </DIV></DIV>
<DIV>
<HR>
</DIV>
<P CLASS="BulletedList" STYLE="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0in; mso-list: none; tab-stops: .5in"><SPAN STYLE="FONT-SIZE: 8pt; COLOR: gray; mso-bidi-font-family: Arial"><FONT FACE="Arial" COLOR="gray" SIZE="1">NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error.</FONT></SPAN></P>
<DIV>
</DIV></BODY></HTML>