pythonpython-3.xxmlrpcclient

How to solve "'xmlrpc.client' not found since 'xmlrpc' is not a package" problem?


This is probably very stupid, but I am stuck with this:

I did a Python script, with only the following lines:

#!/usr/bin/python3

import xmlrpc.client

When executing it, I get this error:

ModuleNotFoundError: No module named 'xmlrpc.client'; 'xmlrpc' is not a package

It says that xmlrpc is not a package. So I look for it:

root@A320M-S2H:/# find . -name "xmlrpc"
./usr/lib/python3.6/xmlrpc

root@A320M-S2H:/# cd /usr/lib/python3.6/xmlrpc/
root@A320M-S2H:/usr/lib/python3.6/xmlrpc# ls -las
total 120
 4 drwxr-xr-x  3 root root  4096 oct 15 11:37 .
20 drwxr-xr-x 31 root root 20480 oct 15 11:37 ..
48 -rw-r--r--  1 root root 48988 oct  8 14:12 client.py
 4 -rw-r--r--  1 root root    38 oct  8 14:12 __init__.py
 4 drwxr-xr-x  2 root root  4096 oct 15 11:37 __pycache__
40 -rw-r--r--  1 root root 37195 oct  8 14:12 server.py

root@A320M-S2H:/usr/lib/python3.6/xmlrpc# cat __init__.py 
# This directory is a Python package.

Can anyone tell me what is happening with this library?


Solution

  • And of course, that was stupid.

    I've just named the script file xmlrpc.py, inside a folder named xmlrpc. Nothing to do with the libraries.

    That was the error. Renamed xmlrpc.py to xmlrpc_01.py and that's it. Always forgot this kind of things.