I have form where student can upload his c programs. Now I want to write a script which will compile and run these programs. I was able to write a script which can compile and run c programs with simple name like hello.c. But the problem is Iam not sure how can I refer the files that were saved with random names in uploads folder, for execution.
Here is my code. import time import subprocess while True: rows = db(db.student.status=='pending').select() ofile = open('C:\\web2py\\applications\\newdropboxmultiupload\\cache\\temp\\hellonewtest.out', 'w') for row in rows: #subprocess.call(["gcc","C:\web2py\hello.c","-o","x"]) subprocess.call(["./x"], stdout=ofile) row.update_record(status='executed') db.commit() time.sleep(60) # check every minute ofile.close() On Friday, June 26, 2015 at 3:19:49 AM UTC-5, Manuele wrote: > Il 24/06/15 21:23, Chaitu P ha scritto: > > I want to compile the files that were uploaded. But the files are > > getting uploaded with some random name. So how can I refer them. > Please give more ditails of what you are trying to do... I guess you are > using a "no dal" form to upload your files... right? > > M. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.