2

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?

falsetru
  • 357,413
  • 63
  • 732
  • 636
Orbiter
  • 49
  • 3
  • 4

2 Answers2

1

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.

mata
  • 67,110
  • 10
  • 163
  • 162
0

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

Please see the already ansewred question

link

Community
  • 1
  • 1
med_alpa
  • 311
  • 1
  • 5
  • 17
  • Relative imports _are_ permitted in py3, just not _implicit_ relative imports. You need the explicit form (`from . import ...`) – mata Jul 28 '13 at 18:01