In Python 2.7, you can do import bidi.algorithm
, but it will fail in Python 3.3. Actually, it comes from changes in the way modules are imported. Notice the python-bidi library was last updated in 2010.
See PEP 328, which also dates back 2010. This PEP addresses the following issue: "Imports can be ambiguous in the face of packages; within a package, it's not clear whether import foo refers to a module within the package or some module outside the package. (More precisely, a local module or package can shadow another hanging directly off sys.path.)"
With the new notation, that is used in Python 3.x, you would write, in "bidi/algorithm.py", from .mirror import MIRRORED
instead of from mirror import MIRRORED
. Notice the dot!
The import would work, but the module bidi.algorithm would still fail to load, because of other incompatibilities. Namely, there is at some point X2_X5_MAPPINGS.keys() + ['BN', 'PDF', 'B']
, which fails because dict.keys()
does not return a list any longer, but a "dict_keys" object.
Therefore, you won't be able to use this package in Python 3.x, unless you are willing to do some work to resolve incompatibilities.
As a side note, the new notation from .mirror import MIRRORED
is also understood by Python 2.7, so it should be possible to make python-bidi to be compatible with both Python 2.x and 3.x lines.