Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Question Regarding SocketServer

Reply
Thread Tools

Question Regarding SocketServer

 
 
missiplicity@yahoo.com
Guest
Posts: n/a
 
      01-25-2005
Hi,
I am newbie to Python language and am taking my baby steps. I am
using Python2.4 from ActiveState on W2K. I am trying to create a simple
SocketServer program. Just adding the following 2 lines of code in the
program result in the errors given below:


import SocketServer
print "SocketServer imported"



Running the above cause the following errors

Traceback (most recent call last):
File "TestServer3.py", line 2, in ?
import SocketServer
File "C:\Python24\lib\SocketServer.py", line 8, in ?
- AF_INET{,6}: IP (Internet Protocol) sockets (default)
AttributeError: 'module' object has no attribute 'StreamRequestHandler'


I actually had more code to get the server running (actually it runs on
Linux), but it was throwing up errors on Windows, so I stripped it down
to the bare minimum to see where I am having an issue. I dont
understand why this is happening. Can someone point to me what I am
doing wrong or what is wrong with my configuration.

Thanks,
Kris

 
Reply With Quote
 
 
 
 
sp1d3rx@gmail.com
Guest
Posts: n/a
 
      01-25-2005
you are missing quotes in "socketserver.py". Make sure the comments at
the top are quoted out. In "IDLE" they should be green.

 
Reply With Quote
 
 
 
 
sp1d3rx@gmail.com
Guest
Posts: n/a
 
      01-25-2005
I tried to reply earlier... basically your "SocketServer.py" file is
messed up. That line "AF_INET{,6}: IP (Internet Protocol) sockets
(default)" should be commented out. It should be part of a block of
lines that are all commented out.

 
Reply With Quote
 
missiplicity@yahoo.com
Guest
Posts: n/a
 
      01-25-2005

http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> I tried to reply earlier... basically your "SocketServer.py" file is
> messed up. That line "AF_INET{,6}: IP (Internet Protocol) sockets
> (default)" should be commented out. It should be part of a block of
> lines that are all commented out.


Thanks for your quick response. I am suprised that "SocketServer.py" is
messed up because I just installed Python and didnt touch any files in
Python's installation folder. Anyway I removed the comments at the top
and I still get the error

File "C:\Python24\lib\SocketServer.py", line 8, in ?

AttributeError: 'module' object has no attribute 'StreamRequestHandler'






If it is of any help here are the first few lines in SocketServer.py


__version__ = "0.4"


import socket
import sys
import os

__all__ =
["TCPServer","UDPServer","ForkingUDPServer","Forkin gTCPServer",

"ThreadingUDPServer","ThreadingTCPServer","BaseReq uestHandler",
"StreamRequestHandler","DatagramRequestHandler ",
"ThreadingMixIn", "ForkingMixIn"]
if hasattr(socket, "AF_UNIX"):
__all__.extend(["UnixStreamServer","UnixDatagramServer",
"ThreadingUnixStreamServer",
"ThreadingUnixDatagramServer"])


I opened the SocketServer.py in the IDE and it seems normal. Is there a
way I can check if the module is corrupted in the IDE?

Thanks,
Kris

 
Reply With Quote
 
missiplicity@yahoo.com
Guest
Posts: n/a
 
      01-25-2005
I figured out my problem. I initially had named my program
SocketServer.py and then compiled it. It created a file
SocketServer.pyc
Then I changed the name of the program to TestServer3.py
but when I imported SocketServer, it was importing from the compiled
file left in the current folder (SocketServer.pyc) I guess. I deleted
it and everything worked. Please bear with my ignorance.
Thanks once again for the help,
Kris

 
Reply With Quote
 
sp1d3rx@gmail.com
Guest
Posts: n/a
 
      01-26-2005
I am glad you were able to figure it out. It's strange that the pyc
file didn't get updated... it should have automatically fixed itself.
*shrug* that's one of those problems that aggrivate you to death...

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
socketserver question K Richard Pixley Python 1 01-08-2012 11:11 AM
newbie question about SocketServer akameswaran@gmail.com Python 2 10-24-2005 02:02 PM
Basic SocketServer & Thread Question john Java 4 06-03-2005 05:03 PM
SocketServer accept() fails to work (Linux) Janusz Java 4 06-01-2004 12:44 PM
SocketServer class - basis problem lebo Python 4 06-24-2003 01:42 PM



Advertisments