this directory contains the following file: /Users/whiteglider/Documents
file name: server.py
this is my practice code that I just copied from http://www.tutorialspoint.com/python/python_networking.htm
import socket s=socket.socket() host=socket.gethostname() port=12345 s.bind((host,port)) s.listen(5) while True: c, addr = s.accept() print 'Got connection from', addr c.send ('Thank you for connecting') c.close()
when i run it in terminal i print
$ python /Users/whiteglider/Documents/server.py
then I get:
File "/Users/whiteglider/Documents/server.py", line 1 {\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf540 ^ SyntaxError: unexpected character after line continuation character
even if I change the directory where the server.py file is located and it starts
python server.py
I still get the same result.
(mac leopard 10.5.8)
source share