Hey guys!
im triyng to run these example codes for a simple connection using these libs, and these errors occurs:

codes:

#server

import SimpleXMLRPCServer
from datetime import datetime

server = SimpleXMLRPCServer.SimpleXMLRPCServer(("localhost", 8888))
server.register_instance(datetime)

server.serve_forever()
#client

import xmlrpclib

server = xmlrpclib.ServerProxy("http://localhost:8888")

print server.now()

en the errors:


Traceback (most recent call last):
File "teste.py", line 1, in <module>
import SimpleXMLRPCServer
File "/usr/lib/python2.5/SimpleXMLRPCServer.py", line 102, in <module>
import xmlrpclib
File "/usr/lib/python2.5/xmlrpclib.py", line 167, in <module>
def escape(s, replace=string.replace):
AttributeError: 'module' object has no attribute 'replace'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/apport_python_hook.py", line 38, in apport_excepthook
from apport.packaging_impl import impl as packaging
File "/usr/lib/python2.5/site-packages/apport/__init__.py", line 1, in <module>
from apport.report import Report
File "/usr/lib/python2.5/site-packages/apport/report.py", line 20, in <module>
from problem_report import ProblemReport
File "/usr/lib/python2.5/site-packages/problem_report.py", line 18, in <module>
from email.MIMEMultipart import MIMEMultipart
File "/usr/lib/python2.5/email/__init__.py", line 79, in __getattr__
__import__(self.__name__)
File "/usr/lib/python2.5/email/mime/multipart.py", line 9, in <module>
from email.mime.base import MIMEBase
File "/usr/lib/python2.5/email/mime/base.py", line 9, in <module>
from email import message
File "/usr/lib/python2.5/email/message.py", line 16, in <module>
import email.charset
File "/usr/lib/python2.5/email/charset.py", line 13, in <module>
import email.quoprimime
File "/usr/lib/python2.5/email/quoprimime.py", line 48, in <module>
from string import hexdigits
ImportError: cannot import name hexdigits

Original exception was:
Traceback (most recent call last):
File "teste.py", line 1, in <module>
import SimpleXMLRPCServer
File "/usr/lib/python2.5/SimpleXMLRPCServer.py", line 102, in <module>
import xmlrpclib
File "/usr/lib/python2.5/xmlrpclib.py", line 167, in <module>
def escape(s, replace=string.replace):
AttributeError: 'module' object has no attribute 'replace'


please, can anyone help me??

Kind of sounds like dependency issues... but seeing as that module is built into Python I don't see how this could happen.

I tried importing those modules (which I've never used before) and they worked. Perhaps you need a reinstallation of Python.

Thx for your reply! =)

ok, i have no ideia the reason why..
but I just changed the place where these programs were...
i created another folder...
and now its working =)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.