peteboyd / lammps_interface

automatic generation of LAMMPS input files for molecular dynamics simulations of MOFs
MIT License
125 stars 63 forks source link

suppress "fatal: not a git repository" message #51

Closed ltalirz closed 2 years ago

ltalirz commented 2 years ago

Installing lammps-interface via pypi is valid as well image

peteboyd commented 2 years ago

Leo do you know a better way to update the version info? Current fix is to have a text file in the base directory that is manually pulled from the git repo. The problem is that every time the text file is updated with the git version, the revision number is incremented.

ltalirz commented 2 years ago

hi Pete, thanks for the quick fix. I actually opened this issue more as a "note to self" - my first line of attack would have been simply to try to capture the output of the git command in order to hide it from the user.

Here should be a python3.6-compatible way of doing this: https://stackoverflow.com/a/53209196/1069467

In [1]: from subprocess import run, PIPE

In [10]: p = run(['git', 'rev-list', 'HEAD'], stdout=PIPE, stderr=PIPE)

In [12]: p.stdout
Out[12]: b''

In [13]: p.stderr
Out[13]: b'fatal: not a git repository (or any of the parent directories): .git\n'