question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Not a built-in template" error, and no built-in templates found

See original GitHub issue

Hi! I have installed licenseheaders-0.8.4 on macOS via pip3, like this:

pip3 install licenseheaders

Installation logs seem fine:

Click to expand
Collecting licenseheaders
  Downloading https://files.pythonhosted.org/packages/80/01/3bcd4063e4ed517ff7e72aad98ab4135b8307585b0022be18e093178cf38/licenseheaders-0.8.4-py3-none-any.whl
Collecting regex (from licenseheaders)
  Downloading https://files.pythonhosted.org/packages/4c/e7/eee73c42c1193fecc0e91361a163cbb8dfbea62c3db7618ad986e5b43a14/regex-2020.4.4.tar.gz (695kB)
     |████████████████████████████████| 696kB 1.0MB/s
Building wheels for collected packages: regex
  Building wheel for regex (setup.py) ... done
  Stored in directory: /Users/folex/Library/Caches/pip/wheels/e6/9b/ae/2972da29cc7759b71dee015813b7c6931917d6a51e64ed5e79
Successfully built regex
Installing collected packages: regex, licenseheaders
Successfully installed licenseheaders-0.8.4 regex-2020.4.4

$ licenseheaders -h usage: licenseheaders [-h] [-V] [-v] [-d DIR] [-b] [-t TMPL] [-y YEARS] [-o OWNER] [-n PROJECTNAME] [-u PROJECTURL] [–enc ENCODING] [–dry] [–safesubst] [-D] [-E [E [E …]]] [–additional-extensions ADDITIONAL_EXTENSIONS [ADDITIONAL_EXTENSIONS …]] [-x [EXCLUDE [EXCLUDE …]]] …

Then, I tried to run it (copied example from README):

$ licenseheaders -t lgpl3 -o "Eager Hacker"
licenseheaders_0.8.4 ERROR: Not a built-in template and not a file, cannot proceed: lgpl3
licenseheaders_0.8.4 ERROR: Built in templates:

Then via python3 -m, same:

$ python3 -m licenseheaders -t lgpl3 -o "Eager Hacker"
licenseheaders_0.8.4 ERROR: Not a built-in template and not a file, cannot proceed: lgpl3
licenseheaders_0.8.4 ERROR: Built in templates:

Reinstall (pip3 uninstall and then pip3 install) didn’t help.

Here’s dist-info/ content:

Click to expand
$ ls -lh /usr/local/lib/python3.7/site-packages/licenseheaders-0.8.4.dist-info/
total 64
-rw-r--r--  1 folex  admin     4B May  5 17:56 INSTALLER
-rw-r--r--  1 folex  admin   1.1K May  5 17:56 LICENSE.txt
-rw-r--r--  1 folex  admin   6.4K May  5 17:56 METADATA
-rw-r--r--  1 folex  admin   833B May  5 17:56 RECORD
-rw-r--r--  1 folex  admin    92B May  5 17:56 WHEEL
-rw-r--r--  1 folex  admin    56B May  5 17:56 entry_points.txt
-rw-r--r--  1 folex  admin    15B May  5 17:56 top_level.txt

Hope my issue will help. Thanks for you project! If you need any info, I’ll try to help.


One-liner to reproduce it with docker

docker run --rm -it python:slim bash -c 'pip install licenseheaders && mkdir -p test && cd test && touch a.java && licenseheaders -t lgpl-v3 -y 2012-2014 -o ThisNiceCompany -n ProjectName -u http://the.projectname.com'

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:4
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
johann-petrakcommented, May 6, 2020

Thank you for this report! I will try to set up some more environments for testing this. If something works for me it obviously can still fail for many others. Sorry about that.

2reactions
johann-petrakcommented, May 6, 2020

Hi! The Docker reproducer still fails with the same error. I can see the templates in the wheel file, and when I run pip install licenseheaders, I see the script installed to /usr/local/bin, while templates go to /usr/local/templates. The latter is pretty unusual; I believe the Filesystem Hierarchy Standard mandates for this stuff to go to /usr/local/share/licenseheaders/templates. But that’s probably setuptools’ fault, not yours.

I guess the reproducer keeps failing now because the script looks for templates right next to itself, i.e. in /usr/local/bin.

OK, I need to figure out how the different ways of installing things do this and how python then sets the __file__ variable when running. I tested this with an anaconda setup and there, everything gets installed into ANACONDAPATH/lib/python3.7/site-packages/licenseheaders-0.8.4-py3.7.egg and a script is installed as ANACONDAPATH/bin/licenseheaders which loads the module from there. The __file__ variable then gets correctly set to the path of the module which is in the .egg directory.

Could you please have a look what the content of the script in /usr/local/bin is? That templates go into /usr/local/templates looks crazy.

Sorry for the inconvenience, I have to admit I do not really understand yet how to do this properly. I will have a closer look and probably reorganize the whole thing (so the src layout does have a proper package, not just the module).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Template a file out to a target host - Ansible Documentation
Templates are processed by the Jinja2 templating language. Documentation on the template formatting can be found in the Template Designer Documentation.
Read more >
Objective-C builtin template system? - Stack Overflow
No, Objective-C has no built-in template system. Generally for simple uses you'd just use textual replacement (possibly via stringWithFormat: ) ...
Read more >
Built-in template tags and filters - Django documentation
Defines a block that can be overridden by child templates. See Template inheritance for more information. comment ...
Read more >
Custom templates for dotnet new - .NET CLI - Microsoft Learn
The dotnet new command isn't only the way to use a template, ... To list the built-in templates, run the dotnet new list...
Read more >
Development guide for GitLab CI/CD templates
You should not add this template to an existing `.gitlab-ci.yml` file by using ... .gitlab-ci.yml immediately causes a lint error because there are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found