Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mrbod fails: TypeError: expected str, bytes or os.PathLike object, not NoneType #89

Open
htgoebel opened this issue Oct 5, 2019 · 2 comments

Comments

@htgoebel
Copy link

htgoebel commented Oct 5, 2019

When I try to setup a template using mrbob, mrbob crashes with (full traceback see below):

TypeError: expected str, bytes or os.PathLike object, not NoneType

How to reproduce (taken from https://training.plone.org/5/theming/theme-package.html)

virtualenv --python /usr/bin/python3.7 /tmp/mrbobvenv
cd /tmp/mrbobvenv
bin/pip install mr.bob bobtemplates.plone
bin/mrbob -O plonetheme.tango bobtemplates:plone_addon

Traceback:

Traceback (most recent call last):
  File "bin/mrbob", line 10, in <module>
    sys.exit(main())
  File "/tmp/mrbobvenv/lib/python3.7/site-packages/mrbob/cli.py", line 155, in main
    defaults=defaults)
  File "/tmp/mrbobvenv/lib/python3.7/site-packages/mrbob/configurator.py", line 138, in __init__
    self.template_dir, self.is_tempdir = parse_template(template)
  File "/tmp/mrbobvenv/lib/python3.7/site-packages/mrbob/configurator.py", line 92, in parse_template
    path = resolve_dotted_path(template_name)
  File "/tmp/mrbobvenv/lib/python3.7/site-packages/mrbob/configurator.py", line 40, in resolve_dotted_path
    return os.path.join(os.path.dirname(module.__file__), dir_name)
  File "/tmp/mrbobvenv/lib64/python3.7/posixpath.py", line 156, in dirname
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType
@htgoebel
Copy link
Author

htgoebel commented Oct 5, 2019

I digged a bit into this and discovered that `bobtemplates? is a namespace module:

> /tmp/mrbobenv/lib/python3.7/site-packages/mrbob/configurator.py(40)resolve_dotted_path()
-> return os.path.join(os.path.dirname(module.__file__), dir_name)
(Pdb) p module
<module 'bobtemplates' (namespace)>

Expected behavior

mrbob should catch this case and fail with a meaningfull error message.

I assume this error is caused by changing the structure of the bobtemplates packages. Thus the error message could mention this detail a a possible cause.

@mck9
Copy link

mck9 commented Dec 9, 2019

Maybe the Plone documentation should be fixed instead. This works:

bin/mrbob -O plonetheme.tango bobtemplates.plone:addon

mck9 added a commit to mck9/documentation that referenced this issue Dec 9, 2019
Original call fails with
TypeError: expected str, bytes or os.PathLike object, not NoneType

See collective/mr.bob#89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants