OpenSource For You

We take a look at Dryrun, an email-based interface via which you can run programs.

-

Dryrun (https://bitbucket.org/amitksaha/dryrun) attempts to present an email-based interface to run your programs. For example, if icanhazout­put@gmail.com is the designated email address, an email message such as the one below will result in a reply to the sender with a message containing the output of the submitted code. To: icanhazout­put@gmail.com Subject: python Body: #!/usr/bin/python print “Hello World!”

The reply will contain a file, process.log, which has the following message: Output produced during processing of your file Hello World!

This is a simple example of how dryrun works. So why would this be useful to you? The usefulness of this idea is debatable. However, what it allows you to do is use any Internet-connected device to send code snippets in an email, and get back the output. As you think of ways in which you may plan to use such a service, let us next look at how you can run your service. method, which is called by the dryrun_driver script. In this script, the imap_access method is used to obtain the request details— sender, programmin­g language and the code itself. Then, it checks if the programmin­g language is supported, using the ‘extensions’ dictionary. If supported, the execute_code method is called to run it. Here, the appropriat­e program to process the code is chosen: gcc for C, g++ for C++, and python or pdflatex for Latex files. The Python subprocess module is then used to run this code after it has been written to a file named code.<extension>, where the extension is chosen appropriat­ely from the extensions dictionary. The output obtained is then stored to a file called process.log, which is sent back as an email to the sender, in the method send_output.

imaplib2.py: This is the threaded IMAP4 client based on RFC 3501 and the original imaplib module ( https://www.it.usyd.edu. au/~piers/python/imaplib2). To run this service, simply execute dryrun_driver.py, using python dryrun_driver.py. Ensure the appropriat­e programmin­g tools are installed, and try out how it works by sending an email in the form discussed above.

 ??  ??

Newspapers in English

Newspapers from India