I think Mariusz is trying to say: using a directory named "json" fools
Python into trying to load _that_ directory, rather than the stdlib "json"
module.

This is more or less the same problem that I described here:

http://stackoverflow.com/questions/28730964/why-does-my-import-requests-fail-with-importerror-no-module-named-requests-p

On Sat, Aug 22, 2015 at 4:44 AM, Mariusz Szot <mun...@gmail.com> wrote:

> Hi,
>
> Please,
> Change your directory name json, for example json_renderer,
> json name, causes the python looking json dumps in the directory and not
> site-packages.
>
>
>
> http://docs.pylonsproject.org/projects/pyramid/en/latest/quick_tutorial/json.html
>
>
> exc:
> E
> ======================================================================
> ERROR: Failure: AttributeError ('module' object has no attribute 'dumps')
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "/home/ms/env/local/lib/python2.7/site-packages/nose/loader.py",
> line 414, in loadTestsFromName
>     addr.filename, addr.module)
>   File "/home/ms/env/local/lib/python2.7/site-packages/nose/importer.py",
> line 47, in importFromPath
>     return self.importFromDir(dir_path, fqname)
>   File "/home/ms/env/local/lib/python2.7/site-packages/nose/importer.py",
> line 94, in importFromDir
>     mod = load_module(part_fqname, fh, filename, desc)
>   File "/home/ms/PycharmProjects/test_pyramid/json/tutorial/__init__.py",
> line 1, in <module>
>     from pyramid.config import Configurator
>   File
> "/home/ms/env/local/lib/python2.7/site-packages/pyramid-1.5.1-py2.7.egg/pyramid/config/__init__.py",
> line 65, in <module>
>     from pyramid.config.rendering import RenderingConfiguratorMixin
>   File
> "/home/ms/env/local/lib/python2.7/site-packages/pyramid-1.5.1-py2.7.egg/pyramid/config/rendering.py",
> line 7, in <module>
>     from pyramid import renderers
>   File
> "/home/ms/env/local/lib/python2.7/site-packages/pyramid-1.5.1-py2.7.egg/pyramid/renderers.py",
> line 173, in <module>
>     class JSON(object):
>   File
> "/home/ms/env/local/lib/python2.7/site-packages/pyramid-1.5.1-py2.7.egg/pyramid/renderers.py",
> line 221, in JSON
>     def __init__(self, serializer=json.dumps, adapters=(), **kw):
> AttributeError: 'module' object has no attribute 'dumps'
>
>
> Mariusz Szot
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pylons-discuss+unsubscr...@googlegroups.com.
> To post to this group, send email to pylons-discuss@googlegroups.com.
> Visit this group at http://groups.google.com/group/pylons-discuss.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-discuss+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-discuss@googlegroups.com.
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to