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

Failed to initialize project. exit status 127 #3

Closed
berndca opened this issue Apr 5, 2016 · 7 comments
Closed

Failed to initialize project. exit status 127 #3

berndca opened this issue Apr 5, 2016 · 7 comments
Labels

Comments

@berndca
Copy link

berndca commented Apr 5, 2016

I'm getting an error running gauge --init python. I have installed getgauge-0.1.1.

Please advise.
Thanks, Bernd

$ gauge --init python

 create  manifest.json
 create  specs
 create  specs/example.spec
 create  env
 create  env/default
 create  env/default/default.properties
/usr/bin/env: python -u: No such file or directory

$ gauge -v

Gauge version: 0.4.0

Plugins
-------
html-report (2.1.0)
java (0.3.4)
python (0.1.1)
@berndca
Copy link
Author

berndca commented Apr 5, 2016

Changed first line in ~/.gauge/plugins/python/0.1.1/start.py from

#! /usr/bin/env python -u

to

#! /usr/bin/env python

and running gauge in a virtualenv (pyvenv) fixed the issue in Elementary OS (Ubuntu LTS 14.04).

@kashishm
Copy link
Collaborator

kashishm commented Apr 6, 2016

-u flag is just for unbuffered binary stdout and stderr, this should not fail/stop the runner.
This is a bug in runner. It happens when python executable is not present in /usr/bin
Could you please share the location of the python executable?
you can try creating a symlink of python in /usr/bin and refer it to python executable, this should fix the issue for now.

@kashishm kashishm added the bug label Apr 6, 2016
@berndca
Copy link
Author

berndca commented Apr 6, 2016

Interesting! I'm using pyenv (https://github.com/yyuu/pyenv) which changes the python path to

/home/bernd/.pyenv/shims/python

However I understand that since I'm using the latest version of getgauge I need python 3. That would mean to either call /usr/bin/python3 or work with a virtualenv. Changing /usr/bin/python to python3 is not an option. I ended up using a virtualenv and the path to the python executable in this context is

/home/bernd/Downloads/gauge/s5/gauge_venv/bin/python

You should be able to reproduce the by using a virtualenv.

@berndca
Copy link
Author

berndca commented Apr 6, 2016

It appears that you can not pass arguments to python when using /usr/bin/env:

https://unix.stackexchange.com/questions/29608/why-is-it-better-to-use-usr-bin-env-name-instead-of-path-to-name-as-my/29620#29620

@kashishm
Copy link
Collaborator

kashishm commented Apr 8, 2016

Thanks for the info @berndca. I have released a new version with the fix. Run the following commands to update the plugin and package.

gauge --update python
pip install getgauge --upgrade

Follow the docs, If print statements are getting printed at the end of execution.

@berndca
Copy link
Author

berndca commented Apr 8, 2016

Thanks! Did you consider to replace start.py with a start.sh in which PYTHONUNBUFFERED is set and the new/renamed start.py is called?

@kashishm
Copy link
Collaborator

There were two solutions to this issue:

  • Add start.sh which will call start.py with PYTHONUNBUFFERED set as env var(as you suggested) or pass -u flag to python executable.
  • Add a python.properties file with PYTHONUNBUFFERED = 1 and let Gauge handle this while execution.

I implemented it using the second approach, but I think it would work with both the approcahes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants