我试图使用moviepy库创建一个使用python的应用程序.我用它安装了:
pip install moviepy
Run Code Online (Sandbox Code Playgroud)
我从MoviePy崩溃课程中找到了这个:
# Import everything needed to edit video clips
from moviepy.editor import *
Run Code Online (Sandbox Code Playgroud)
尝试运行此行后,我收到此错误:
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> # Import everything needed to edit video clips
... from moviepy.editor import *
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "C:\Python27\lib\site-packages\moviepy\editor.py", line 22, in <module>
from .video.io.VideoFileClip import VideoFileClip
File "C:\Python27\lib\site-packages\moviepy\video\io\VideoFileClip.py", line 3, …
Run Code Online (Sandbox Code Playgroud) 我需要创建一个侦听TCP连接的简单服务器.如果它接收文本on<EOF>
或off<EOF>
然后它发送(回声)success
.接收部分正在工作,但现在我需要它发回success
.
码:
# import threading
import SocketServer
class TCPHandler(SocketServer.BaseRequestHandler):
def handle(self):
self.msg = self.request.recv(1024).strip()
if self.msg == "on<EOF>":
print "Turning On..."
#ECHO "SUCCESS<EOF>" <----- I need the server to echo back "success"
if self.msg == "off<EOF>":
print "Turning Off..."
#ECHO "SUCCESS<EOF>" <----- I need the server to echo back "success"
if __name__ == "__main__":
host, port = '192.168.1.100', 1100
# Create server, bind to local host and port
server = SocketServer.TCPServer((host,port),TCPHandler)
print …
Run Code Online (Sandbox Code Playgroud)