Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

AttributeError: 'module' object has no attribute 'add_to_builtins' #13

Closed
FaisalAbid opened this issue Jun 5, 2015 · 19 comments
Closed

Comments

@FaisalAbid
Copy link

After installing via pip (python 2.7.6) I keep getting this error

generate_library --input=drumroll.v1.json --language=java --output_dir=/test

Traceback (most recent call last):
File "/usr/local/bin/generate_library", line 9, in
load_entry_point('google-apis-client-generator==1.4.2', 'console_scripts', 'generate_library')()
File "/Library/Python/2.7/site-packages/googleapis/codegen/script_stubs.py", line 9, in RunGenerateLibrary
from googleapis.codegen import generate_library
File "/Library/Python/2.7/site-packages/googleapis/codegen/generate_library.py", line 35, in
from googleapis.codegen import generator_lookup
File "/Library/Python/2.7/site-packages/googleapis/codegen/generator_lookup.py", line 10, in
from googleapis.codegen import csharp_generator
File "/Library/Python/2.7/site-packages/googleapis/codegen/csharp_generator.py", line 23, in
from googleapis.codegen import api
File "/Library/Python/2.7/site-packages/googleapis/codegen/api.py", line 39, in
from googleapis.codegen import data_types
File "/Library/Python/2.7/site-packages/googleapis/codegen/data_types.py", line 24, in
from googleapis.codegen import template_objects
File "/Library/Python/2.7/site-packages/googleapis/codegen/template_objects.py", line 27, in
from googleapis.codegen.django_helpers import MarkSafe
File "/Library/Python/2.7/site-packages/googleapis/codegen/django_helpers.py", line 50, in
django_template.add_to_builtins(
AttributeError: 'module' object has no attribute 'add_to_builtins'

@aiuto
Copy link
Contributor

aiuto commented Jun 6, 2015

I believe this is a problem with Django 1.8. Try downgrading to 1.7.

sudo pip uninstall django
sudo pip install django==1.7.7

@FaisalAbid
Copy link
Author

Yes this was the problem, that fixed it.

@aiuto aiuto reopened this Jun 23, 2015
@aiuto
Copy link
Contributor

aiuto commented Jun 23, 2015

Re-opening so people can find it.

@aiuto
Copy link
Contributor

aiuto commented Jun 23, 2015

whoops. reopen again.

@aiuto aiuto reopened this Jun 23, 2015
@FaisalAbid
Copy link
Author

Ha okay cool!

@mcohoon
Copy link

mcohoon commented Sep 17, 2015

I think that the problem is that this library needs to be updated on pypi

@aiuto
Copy link
Contributor

aiuto commented Jan 15, 2016

I have no problems using 1.8. Perhaps the problem is really 1.8. I have not migrated to that yet.

@aiuto
Copy link
Contributor

aiuto commented Jan 19, 2016

setup.py fixed in b584f76

@tswast
Copy link

tswast commented Apr 5, 2016

I hit this issue today, too. We should release a version with the fix to pypi, if it is indeed fixed.

@tswast
Copy link

tswast commented Apr 5, 2016

I'm getting this error when building from source, too, not just the pypi package. The setup.py script is installing django 1.9rc1

$ pip uninstall django
$ python setup.py install --user
$ pip show django
---
Metadata-Version: 1.1
Name: Django
Version: 1.9rc1

After changing to exactly version 1.8.12, the generate_library command works again.

diff --git a/setup.py b/setup.py
index 10db46a..6b566c4 100644
--- a/setup.py
+++ b/setup.py
@@ -28,7 +28,7 @@ setup(
              'googleapis.codegen.script_stubs:RunExpandTemplates')
             ]},
     include_package_data=True,
-    install_requires=['django<1.9',
+    install_requires=['django==1.8.12',
                       'httplib2',
                       'google-apputils',
                       'python-gflags',

@mtucker6784
Copy link

was this ever done as a PR? I ran into the same problem, used the 1.7.7 library and it worked

@tswast
Copy link

tswast commented Sep 29, 2016

We just pushed the change to fix this. Sorry, it was fixed in our internal repo but never synced the change back.

@mtucker6784
Copy link

Oh no it's all good. Thank you for getting all this together!

On Thursday, September 29, 2016, Tim Swast notifications@github.com wrote:

We just pushed the change to fix this. Sorry, it was fixed in our internal
repo but never synced the change back.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#13 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABiNklQXzdZItBiDgPVH6W11Xnn4v-Xnks5qu_LFgaJpZM4E548T
.

Michael Tucker
Tucker Tech Online, LLC
http://www.tuckertechonline.com/
480-620-4506

@jeffkpayne
Copy link

@tswast Any chance this fix can be deployed to PyPi?

@cramertj
Copy link
Member

I hit this error today, so this is still an issue. If this is fixed internally, it'd be nice if it could be synced.

@aiuto
Copy link
Contributor

aiuto commented Jul 12, 2017 via email

@cramertj
Copy link
Member

Yes, it is a version mismatch. However, it means that the README instructions (pip install google-apis-client-generator and then run the script) don't work.

@cramertj
Copy link
Member

Looks like there's even an open PR to fix it (#18).

@tswast
Copy link

tswast commented Aug 21, 2017

This is fixed in the latest version. https://pypi.python.org/pypi/google-apis-client-generator/1.4.3

@jeffkpayne Just released it today. Sorry it took so long for me to figure out how to get access to release the version to PyPI.

@aiuto @SurferJeffAtGoogle I believe we can close this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants