On 06/03/17 17:35, leam hall wrote: > What am I missing? I'd start by moving the import out of the class to its more normal position at the top of the file.
> #### > class mysocket(): > import socket > def __init__(self, sock=None); > if sock is None: > self.sock = socket.socket(socket.socket.AF_NET, > socket.socket.SOCK_STREAM) > else: > self.sock = sock > > > #### > Error: > NameError: global name "socket" is not defined. I'd then send us the complete error trace so we can see what is causing the error. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
