On Mon, Dec 5, 2011 at 5:08 PM, Vinay Sajip <[email protected]> wrote:

> On Dec 6, 12:45 am, Ian Clelland <[email protected]> wrote:
> > After a lot of troubleshooting, and fun installing Python3.2 under
> > virtualenv (Vinay, I think I ran into the same issue as you here:
> https://github.com/pypa/virtualenv/issues/194), I almost have the complete
> > test suite running under MacPorts Python 3.2.2.
>
> That's good news about the state of the tests on MacPorts 3.2.2. I
> hope Carl reads your mail about the virtualenv issue :-)
>
> > While installing Vinay's port (cloned freshly this morning from
> Bitbucket),
> > I had to edit four files, in order to get them to run under Python 3:
> [snip]
> > Did I miss a step here, or not see an error which should have been
> > corrected earlier? Nobody else has commented about Python3 syntax errors,
> > so I'm thinking it's my process.
>
> No, I got those today, too - but not on earlier days, for many days. I
> suspect that it's something to do with merging upstream changes into
> my port, but I haven't pinned it down. I pushed my changes this
> afternoon, so you could try pulling my changes and re-testing.
>


Those definitely work better -- I can go from download to testing, with
only having to copy over the build directory. The only test failure I still
get is this one:

======================================================================
ERROR: test_existing (regressiontests.templates.loaders.EggLoaderTest)
A template can be loaded from an egg
----------------------------------------------------------------------
Traceback (most recent call last):
  File
"/Users/ian/Code/Frameworks/py3k_django/build/tests/regressiontests/templates/loaders.py",
line 88, in test_existing
    contents, template_name = egg_loader.load_template_source("y.html")
  File
"/Users/ian/Code/Frameworks/py3k_django/3k/django/template/loaders/eggs.py",
line 28, in load_template_source
    raise TemplateDoesNotExist(template_name)
django.template.base.TemplateDoesNotExist: y.html

----------------------------------------------------------------------


It appears that an error is being returned earlier, in line 25 of
template/loaders/eggs.py.

return (resource_string(app, pkg_name).decode(settings.FILE_CHARSET),
'egg:%s:%s' % (app, pkg_name))


pkg_resources.resource_string is returning a Py3k <'str'>, which has an
'encode' method, but no 'decode'. The AttributeError is getting swallowed
and re-raised as a TemplateDoesNotExist.

pkg_resouces comes from distribute, which I just installed this morning for
the virtualenv

(Pdb) import pkg_resources
(Pdb) pkg_resources.__file__
'/Users/ian/.virtualenvs/py3k_django/lib/python3.2/site-packages/distribute-0.6.21-py3.2.egg/pkg_resources.py'


If I replace line 25 with this block:

resource_name = resource_string(app, pkg_name)
if hasattr(resource_name, 'decode'):
    resource_name = resource_name.decode(settings.FILE_CHARSET)
return (resource_name, 'egg:%s:%s' % (app, pkg_name))


then all (expected) tests pass.

--
Regards,
Ian Clelland
<[email protected]>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to