Orbiter
Orbiter

Reputation: 49

Python ImportError: No module named 'xxxx'

Getting error:

Traceback (most recent call last):
File "C:/Python33/Lib/123.py", line 5, in <module>
from wordpress_xmlrpc import Client, WordPressPost
File "C:/Python33/lib/site-packages/wordpress_xmlrpc/__init__.py", line 6, in <module>
import base
ImportError: No module named 'base'

base.py is located in:

C:\Python33\Lib\site-packages\wordpress_xmlrpc\

__init__.py looks like:

from base import *
from wordpress import *
import methods

All other imports I use work fine.

Path variables look like:

C:\Python33;C:\Python33\Scripts;C:\Python33\Lib\site-packages;C:\Python33\Lib\site-packages\wordpress_xmlrpc;C:\Python33\Lib;

Does anyone know why I get this error?

Upvotes: 2

Views: 3969

Answers (2)

mata
mata

Reputation: 69022

You need to use either explicit relative or absolute imports when you use python3, so

from wordpress_xmlrpc import base
# or
from . import base

In python3 import base would only import an absolute package base, as implicit relative imports are no longer supported.

Upvotes: 1

med_alpa
med_alpa

Reputation: 292

Relative imports are used with a "." when using python 3.

Please see the already ansewred question

link

Upvotes: 0

Related Questions