Python batch submits sandbox problem instances and python sandbox instances

Source: Internet
Author: User

Python batch submits sandbox problem instances and python sandbox instances

The example in this article describes how to submit sandboxes in batches in python and share them with you for your reference. The specific method is as follows:

The following problems occur:

1. Use of Popen. in linux, parameters are passed through the list. Do not use strings. Otherwise, the error "OSErrorror: [Errno 2] No such file or directory" may occur.

2. If the list needs to be copied and used in the shutil module, otherwise it will consecutively append... after the first sample is submitted, the subsequent submission parameters will be 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")   submit_cuckoo.submit_cuckoo() 

I hope this article will help you with Python programming.


Batch transaction submission failed due to the problem of batch mysql Data insertion in python

Conn. commit () # You have missing the brackets

Python batch processing excel Data

Is there a problem with new_row1? Write it to a new sheet. You can easily modify the row number while reading the table.
 

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.