sebix / python-textile

A Python port of Textile, A humane web text generator
https://github.com/textile/python-textile/
Other
62 stars 43 forks source link

ImportError on Python 3 #14

Closed mblayman closed 8 years ago

mblayman commented 10 years ago

Hi, I'm trying to use textile for a project of mine that I want to support Python 3. Importing the textile package triggers an ImportError.

You can reproduce this with tox. Here is my tox.ini file:

[tox]
envlist = py34

[testenv]
deps = nose
       coverage
commands = nosetests

I think the problem is related to relative imports. Here are my results:

matt@eden:~/python-textile$ tox -e py34
GLOB sdist-make: /home/matt/python-textile/setup.py
py34 inst-nodeps: /home/matt/python-textile/.tox/dist/textile-2.1.5.zip
py34 runtests: PYTHONHASHSEED='4057464796'
py34 runtests: commands[0] | nosetests
E
======================================================================
ERROR: Failure: ImportError (No module named 'functions')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/matt/python-textile/.tox/py34/lib/python3.4/site-packages/nose/failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "/home/matt/python-textile/.tox/py34/lib/python3.4/site-packages/nose/loader.py", line 414, in loadTestsFromName
    addr.filename, addr.module)
  File "/home/matt/python-textile/.tox/py34/lib/python3.4/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/home/matt/python-textile/.tox/py34/lib/python3.4/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/home/matt/python-textile/.tox/py34/lib/python3.4/imp.py", line 245, in load_module
    return load_package(name, filename)
  File "/home/matt/python-textile/.tox/py34/lib/python3.4/imp.py", line 217, in load_package
    return methods.load()
  File "<frozen importlib._bootstrap>", line 1220, in load
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1448, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "/home/matt/python-textile/textile/__init__.py", line 1, in <module>
    from functions import textile, textile_restricted, Textile
ImportError: No module named 'functions'

Name                      Stmts   Miss  Cover   Missing
-------------------------------------------------------
textile/__init__              2      1    50%   3
textile/functions           469    469     0%   4-1001
textile/tests/__init__      139    139     0%   2-442
textile/textilefactory       27     27     0%   1-74
textile/tools/__init__        0      0   100%   
textile/tools/imagesize      24     24     0%   1-41
textile/tools/sanitizer      20     20     0%   1-35
-------------------------------------------------------
TOTAL                       681    680     1%   
----------------------------------------------------------------------
Ran 1 test in 0.039s

FAILED (errors=1)
ERROR: InvocationError: '/home/matt/python-textile/.tox/py34/bin/nosetests'
___________________________________ summary ____________________________________
ERROR:   py34: commands failed
sebix commented 8 years ago

Fixed in textile/python-textile == version on pip