小编Bas*_*sse的帖子

Python'subprocess'CallledProcessError:Command'[...]'返回非零退出状态1

执行以下脚本......

import socket                   
import sys                          

from collections import OrderedDict
from subprocess import check_output
from threading import Thread    
Run Code Online (Sandbox Code Playgroud)

[...]

class IpCheck(Thread):  

    RECEIVED_PACKAGES_RE = re.compile(r'(\d+) received')

    def __init__(self, ip):                         
        Thread.__init__(self)
        self.ip = ip
        self.result = None

    def run(self):                          
        match = self.RECEIVED_PACKAGES_RE.search(
            check_output(['ping', '-q', '-c2', '-W1', self.ip])
        )

        successful_ping_count = int(match.group(1)) if match else 0

        if successful_ping_count == 0:
            self.result = 'no response'
        elif successful_ping_count == 1:
            self.result = 'alive, but 50% package loss'
        elif successful_ping_count == 2:
            self.result = check_snmp(self.ip)
        else:
            assert …
Run Code Online (Sandbox Code Playgroud)

python subprocess stdout popen

5
推荐指数
1
解决办法
4万
查看次数

AJAX不传输数据

我想将数据从一个页面传输到另一个页面.我有2个页面:hostSettings.php和test.php

好的,这是我的test.php它包括一个提交按钮和ajax/jquery脚本

<html>
  <head>
    <link href="CSS/style.css" type="text/css" rel="stylesheet" />
    <script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
    <script>

      $(document).ready(function() {
        $('#button').on('submit', function(e) {
          e.preventDefault();
          var test = "Hallo Welt!";
          $.ajax({
            url: "hostSettings.php",
            type: "POST", 
            data: { test : test },
            success: function (response) {
              console.log("data transmitted: " + response);
            },
            error: function(jqXHR, textStatus, errorThrown) {
              alert("Es ist ein Fehler aufgetreten!\n" + textStatus + "\n" + errorThrown);
              console.log(textStatus, errorThrown);
            }
          }); 

        });
      });
    </script>
  </head>

  <body>
    <font size="4">Test-Site</font>
    <hr>
    <?php include ("menu.html");?><br><br>

    <form method="POST" action="hostSettings.php">
      <input …
Run Code Online (Sandbox Code Playgroud)

php ajax jquery

1
推荐指数
1
解决办法
71
查看次数

标签 统计

ajax ×1

jquery ×1

php ×1

popen ×1

python ×1

stdout ×1

subprocess ×1