On Mon, Nov 21, 2011 at 7:02 AM, Andrew <andrew.chapkow...@gmail.com> wrote: > Hello List, > > How to do you create a server that accepts a set of user code? > > For example, > > I would like to send this function: > def addition(x,y): > return x+y > and have the socket server perform the operation and send is back to > the end user. > > Question 2: > On that same server, I want a user to be able to pass a file to the > server along with code. What is the best way to pass file to the > server?
The easiest way is to write an HTTP server (Python has some tools that will make this easy) and use an HTML form, which can do file uploads as well as accept keyed-in code. However, you will run into some fairly major security issues. You're accepting code across the internet and running it. Python does not protect you against malicious users reading files from your hard disk or, worse, modifying those files. This sort of thing can ONLY be used in a trusted environment - a local network on which you know everything that's happening. ChrisA -- http://mail.python.org/mailman/listinfo/python-list