This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: import xmlrpclib not works in file named ""
Type: compile error Stage: resolved
Components: Windows Versions: Python 2.7
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: berker.peksag, fgyuri, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2018-07-27 16:17 by fgyuri, last changed 2022-04-11 14:59 by admin. This issue is now closed.

File name Uploaded Description Edit fgyuri, 2018-07-27 16:17
Messages (2)
msg322505 - (view) Author: Fekete György (fgyuri) Date: 2018-07-27 16:17
Big magic in python 2.7.15 win version:

Create file: "" containing 2 code lines:

import xmlrpclib

proxy = xmlrpclib.ServerProxy("http://localhost:8000/")

run it, and it gives u a nice error:
Traceback (most recent call last):
  File "", line 1, in <module>
    import xmlrpclib
  File "C:\Python27\lib\", line 538, in <module>
    from xml.parsers import expat
  File "C:\work\mitre\", line 3, in <module>
    proxy = xmlrpclib.ServerProxy("http://localhost:8000/")
AttributeError: 'module' object has no attribute 'ServerProxy'

U also get this error, when this file present in the directory where u want to import xmlrpclib in another py. ANd if only the compiled xml.pyc exist, the bug comes.  But if you rename it to, it works!

Maybe a bad import from wrong directory in xmlrpclib. Not tested on another version or platform.
msg322507 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2018-07-27 16:23
This is expected, because there is a package named 'xml' in the Python standard library. See and for details.
Date User Action Args
2022-04-11 14:59:03adminsetgithub: 78431
2018-07-27 16:23:23berker.peksagsetstatus: open -> closed

nosy: + berker.peksag
messages: + msg322507

resolution: not a bug
stage: resolved
2018-07-27 16:17:54fgyuricreate