473,242 Members | 1,739 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,242 software developers and data experts.

Question Regarding SocketServer

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

Jul 18 '05 #1
5 2636
you are missing quotes in "socketserver.py". Make sure the comments at
the top are quoted out. In "IDLE" they should be green.

Jul 18 '05 #2
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.

Jul 18 '05 #3

sp*****@gmail.com 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

Jul 18 '05 #4
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

Jul 18 '05 #5
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...

Jul 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jason Kratz | last post by:
After figuring out the other day (thanks to everyone here who helped) how to get the dir lists I want on my unix machine I want to turn the same thing into an XML-RPC service. Using Simple...
3
by: Olivier Hoarau | last post by:
Hello, I have build a client/server application with the socket module. The server mades UDP broadcasting and the client only reads UDP broadcast messages. All work fine. Now I want to use for...
3
by: Ergin Aytac | last post by:
I'm trying to run a script written in python and have some socket connection problems. I cutted the origin script (more than 1000 lines) so it is only the part of the connection and there is no...
0
by: Frederick Grim | last post by:
Howdy group, So I am in the middle of using the socketserver class from the std library and have run into a problem that probably reveals my misunderstanding of sockets. I have a class defined...
6
by: duncanm255 | last post by:
I am relatively new to Python, and wanted to see if this is even possible, and if so how to go about implementing it. What I'm looking to do is create a client/server application that does the...
0
by: Tomi Hautakoski | last post by:
Hello, I'm a Python newbie trying to figure out how to use SocketServer with IPv6. I would like to set up a TCPServer working like below but how to tell SocketServer I need to use AF_INET6? ...
5
by: eliben | last post by:
Hello, I have a small wxPython application. Today I was trying to add some RPC capability to it, so I implemented an instance of SimpleXMLRPCServer that runs in a separate thread when invoked...
2
by: John Salerno | last post by:
I'm now experimenting with the SocketServer class. Originally I subclassed the StreamRequestHandler to make my own custom handler, but a result of this seems to be that the client socket closes...
1
by: k3xji | last post by:
Hi all, I am trying to develop a game-server in python. Design is as following: - ConnectionManager - handling/distributing incoming connections - IOManager - handling IO recv/send operations...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.