On 8 Jan 2007 12:29:36 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > [EMAIL PROTECTED] wrote: >> Is it possible to execute a binary string stored within a python script >> as executable code ? >> >> The script is run under Windows, and the binary code (a full executable >> file) is stored in a variable in the script. >> >> I know I can use os.system() or os.popen() to run an external file, but >> these functions take as argument a string evaluated as command-line. >> >> I also know I could save the binary code as a temporary file, execute >> it and delete it afterwards, but this is not an alternative. >> >> Thanks. > > It's not impossible, that's basically what I did on a smaller scale in > pyasm:
For what it's worth[1], under Unix it /is/ impossible. The only way to bring in new code (short of dynamic libraries) is to call exec(2) or its variations, and all need a file system object to load the code from. /Jorgen [1] Not much to the OP, I'd think. -- // Jorgen Grahn <grahn@ Ph'nglui mglw'nafh Cthulhu \X/ snipabacken.dyndns.org> R'lyeh wgah'nagl fhtagn! -- http://mail.python.org/mailman/listinfo/python-list