Python Batch submission sandbox problem instance

Source: Internet
Author: User
This article describes the Python batch submission sandbox problem, share to everyone for your reference. Here's how:

The following problems occur:

1. The use of Popen, in Linux under the parameters of the list, do not use string to pass otherwise there may be "oserrorror: [Errno 2] No such file or directory" error

2. List to be copied with Shutil module otherwise it will be append continuously. After the first sample is submitted, the subsequent submission parameters are wrong.

The code is as follows:

Import OS from subprocess Import Popen class Submitcuckoo: "" "" "    def __init__ (self, dirctory):     " "" Constructor "" "     self._dirctory = dirctory     Self._pargs = ["/usr/bin/python ","/home/xxx/xxx/submit.py "]      def _file_callback (self, file_path):     args = ["/usr/bin/python", "/home/xx/xxx/submit.py"]     args.append (file_ Path)     print "args:", args     Popen (args)        def submit_cuckoo (self, File_callback=_file_callback): "     " "" "     dir = self._dirctory     for root, dirs, files in Os.walk (dir): For        F in files:          file_path = os. Path.join (Root, f)          if File_callback:            file_callback (self, file_path)  if __name__ = = "__main__":   Submit_cuckoo = Submitcuckoo (r "/home/xxx/xxx/samples")   

Hopefully this article will help you with Python programming.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.