I recently bought Odroid XU4, a single-board computer with an ARM CPU. I try to run a simple web server using HTTTPServer on Python3.
import http.server
import socketserver
PORT = 8000
Handler = http.server.SimpleHTTPRequestHandler
with socketserver.TCPServer(("", PORT), Handler) as httpd:
print("serving at port", PORT)
httpd.serve_forever()
This code runs well on my Mac machine. But when I try to run this on Odroid XU4, I got this error message.
$ python3 webserver.py
Traceback (most recent call last):
File "test.py", line 8, in <module>
with socketserver.TCPServer(("", PORT), Handler) as httpd:
AttributeError: __exit__
Can anyone explain why I got this error? For your information, I’ve attached the information about the OS and Python interpreter.
$ uname -a
Linux odroid 4.9.44-54 #1 SMP PREEMPT Sun Aug 20 20:24:08 UTC 2017 armv7l armv7l armv7l GNU/Linu
$ python
Python 3.5.2 (default, Aug 18 2017, 17:48:00)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>