Byron / google-apis-rs

A binding and CLI generator for all Google APIs
http://byron.github.io/google-apis-rs
Other
1.02k stars 136 forks source link

ImportError: No module named util #234

Closed mibac138 closed 5 years ago

mibac138 commented 5 years ago

I've tried to build this project by running make, however it fails with

  File "src/mako/deps.mako", line 56, in render_body
    import util
ImportError: No module named util
Makefile:88: .cli.deps: No such file or directory
make: *** [Makefile:83: .cli.deps] Error 1

I have Python 2.7.16, rustc 1.36.0 (a53f9df32 2019-07-03), pyenv set to Python 2.7.16, Wget 1.20.1, and GNU Make 4.2.1. I'm running on a Windows 10 Pro 10.0.18362 with a Linux subsystem. I did not modify the code, just did a git clone of master. I also ran .travis.yml/before_install hoping it would help, but it didn't.

Byron commented 5 years ago

Thanks for letting me know. Trying the same, running make in a fresh clone on OSX worked without issues.

Also I have no idea what could be causing this - the make file should work on any linux system. Maybe it's the default shell that make is using - it tries to set the PYTHONPATH with the VAR=value <program> syntax.

You could try to set the PYTHONPATH manually and see if that works. Maybe that way, we get closer to the cause of the issue, and end up with a fix.

Thanks for you help!

mibac138 commented 5 years ago

Running export PYTHONPATH=/home/mibac/.pyenv/shims/python before make solved the issue for me. Thank you :)

For comparison, before running export, make defined PYTHONPATH as PYTHONPATH=src/mako/lib: . .pyenv-Linux/bin/activate; python etc/bin/mako-render --template-dir '.' -io src/mako/deps.mako=.cli.deps --data-files etc/api/shared.yaml etc/api/type-cli.yaml etc/api/api-list.yaml, where as after, it was defined as PYTHONPATH=src/mako/lib:/home/mibac/.pyenv/shims/python . .pyenv-Linux/bin/activate; python etc/bin/mako-render --template-dir '.' -io src/mako/deps.mako=.cli.deps --data-files etc/api/shared.yaml etc/api/type-cli.yaml etc/api/api-list.yaml

Byron commented 5 years ago

Thank you! This seems to be related to peculiarities of your python setup. Personally I don't understand why setting the given PYTHONPATH works, it's not that it contains util.py, or is it?

In any case, I would like to close this issue as I don't think it can be fixed by me as I can't reproduce it, and there is a workaround.

Additionally, work in the next iteration of the Google-APIs will begin shortly, dropping all python dependencies :).