plone / bobtemplates.plone

Python Code Templates for Plone Projects with mr.bob
https://pypi.org/project/bobtemplates.plone/
GNU General Public License v2.0
24 stars 31 forks source link

AttributeError: 'module' object has no attribute '__file__' #277

Closed abosio closed 6 years ago

abosio commented 6 years ago

Getting this error trying to create a Plone addon with a fresh install of mrbob and bobtemplates.plone.

Steps to reproduce:

$ pip install mr.bob
Collecting mr.bob
  Downloading mr.bob-0.1.2.tar.gz
...{snip}...
Successfully built mr.bob MarkupSafe
Installing collected packages: six, MarkupSafe, Jinja2, mr.bob
Successfully installed Jinja2-2.10 MarkupSafe-1.0 mr.bob-0.1.2 six-1.11.0

$ pip install bobtemplates.plone
Collecting bobtemplates.plone
  Downloading bobtemplates.plone-3.1.2.tar.gz (1.4MB)
...{snip}...
Successfully built bobtemplates.plone lxml stringcase
Installing collected packages: lxml, stringcase, bobtemplates.plone
Successfully installed bobtemplates.plone-3.1.2 lxml-4.2.1 stringcase-1.2.0

$ mrbob -O my.package bobtemplates:plone_addon
Traceback (most recent call last):
  File "/usr/home/abosio/.virtualenvs/mrbob/bin/mrbob", line 11, in <module>
    sys.exit(main())
  File "/usr/home/abosio/.virtualenvs/mrbob/lib/python2.7/site-packages/mrbob/cli.py", line 155, in main
    defaults=defaults)
  File "/usr/home/abosio/.virtualenvs/mrbob/lib/python2.7/site-packages/mrbob/configurator.py", line 138, in __init__
    self.template_dir, self.is_tempdir = parse_template(template)
  File "/usr/home/abosio/.virtualenvs/mrbob/lib/python2.7/site-packages/mrbob/configurator.py", line 92, in parse_template
    path = resolve_dotted_path(template_name)
  File "/usr/home/abosio/.virtualenvs/mrbob/lib/python2.7/site-packages/mrbob/configurator.py", line 40, in resolve_dotted_path
    return os.path.join(os.path.dirname(module.__file__), dir_name)
AttributeError: 'module' object has no attribute '__file__'
MrTango commented 6 years ago

Can you please try with the correct command:

mrbob bobtemplates.plone:addon -O src/collective.foo

This is diffent to earlier version because of an issue with the namespace in the old versions.

abosio commented 6 years ago

Of course, that works. Thank you.

It looks like I picked up the wrong command from docs.plone.org and didn't catch the change.