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

can't use own tempaltes with pdoc #178

Open
undertherain opened this issue Sep 27, 2018 · 4 comments

Comments

Projects
None yet
2 participants
@undertherain
Copy link

commented Sep 27, 2018

I'm trying to use my own templates with pdoc,
I'm specifying path to templates (for starters I took existing templates from this repo and modified them slightly)
I specify --template-dir option, but still see the result rendered with default templates

is there any way to, first of all, see if it is trying even to use new templates? If I provide some garbage as template path it still works

I'm using pdoc 0.3.2 on Python 3.6.5, Ubuntu 18.04.1

@undertherain

This comment has been minimized.

Copy link
Author

commented Sep 27, 2018

Even interestingly, that was happening if I use --html option
if I use default text mode, then if I add template path, I'm getting the following error

Traceback (most recent call last):
  File "/home/blackbird/.local/bin/pdoc", line 483, in <module>
    output = module.text()
  File "/home/blackbird/.local/lib/python3.6/site-packages/pdoc/__init__.py", line 652, in text
    text, _ = re.subn('\n\n\n+', '\n\n', t.render(module=self).strip())
  File "/home/blackbird/.local/lib/python3.6/site-packages/mako/template.py", line 462, in render
    return runtime._render(self, self.callable_, args, data)
  File "/home/blackbird/.local/lib/python3.6/site-packages/mako/runtime.py", line 838, in _render
    **_kwargs_for_callable(callable_, data))
  File "/home/blackbird/.local/lib/python3.6/site-packages/mako/runtime.py", line 873, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/home/blackbird/.local/lib/python3.6/site-packages/mako/runtime.py", line 899, in _exec_template
    callable_(context, *args, **kwargs)
  File "_text_mako", line 86, in render_body
TypeError: object of type 'method' has no len()
@undertherain

This comment has been minimized.

Copy link
Author

commented Sep 27, 2018

using mako version '1.0.7'

@KyleKing

This comment has been minimized.

Copy link

commented Feb 22, 2019

I have the same issue with the latest pdoc (0.3.2) on Windows 7 and Python 3.7.2
I copied the templates from the pdoc templates folder, then tried different modifications to the css.mako.txt and html_index.mako.txt files, but pdoc won't load the templates regardless if from ~/.config/pdoc, ~/.config/pdoc/templates, or specifying a full or relative path with --template-dir

Possibly related to #11 and #69

Update: should be .mako not .mako.txt

@KyleKing

This comment has been minimized.

Copy link

commented Feb 22, 2019

In case this helps with troubleshooting this issue:

I was using Anaconda on Windows 7 with a conda-venv for Python 3.7.2 (base was 2.7.15), so I tried a fresh install of 64-bit Python 3.6.7 from python.org/ and modified my PATH to remove Anaconda. I needed to run pdoc with the absolute path based on #127 (comment). I tried variations of what I thought should work:

$ which python
/c/Users/king.kyle/Python36/python
$ python --version
Python 3.6.7
$ pip install pdoc
$ python C:/Users/king.kyle/Python36/Scripts/pdoc csv --html --overwrite --template-dir templates
$ python C:/Users/king.kyle/Python36/Scripts/pdoc csv --html --overwrite --template-dir C:/Users/king.kyle/templates/

Any thoughts on what might be wrong? Is there any verbose/debugging that can be enabled?

Update: 🤦‍♂️I downloaded the raw files from Github, which added a .txt (*.mako.txt) which is why pdoc couldn't recognize the templates. Anyway removing .txt resolved my issue 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.