Skip to content

Support python 3 in tcp server #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions tcp_server/rpi_gpio_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
"""

import socket
import SocketServer
try:
import socketserver
except ImportError:
import SocketServer as socketserver
import RPi.GPIO as GPIO
import argparse
import subprocess
Expand All @@ -13,7 +16,7 @@
GPIO.setwarnings(False)


class TCP(SocketServer.BaseRequestHandler):
class TCP(socketserver.BaseRequestHandler):

pinlist = [3, 5, 7, 8, 10, 11, 12, 13, 15, 16]

Expand Down Expand Up @@ -132,7 +135,7 @@ def main():
HOST, PORT, CAMERA = args.host, args.port, args.camera
if CAMERA == 'y':
p = subprocess.Popen("python -c 'import jpg_streamer; jpg_streamer.main()'", shell=True)
server = SocketServer.TCPServer((HOST, PORT), TCP)
server = socketserver.TCPServer((HOST, PORT), TCP)
# interrupt with Ctrl+c
server.serve_forever()

Expand Down