fortran-lang / fprettify

auto-formatter for modern fortran source code
https://pypi.python.org/pypi/fprettify
Other
370 stars 76 forks source link

Use `raise Exception from None` in `except` clauses to suppress messages #90

Closed e-kwsm closed 3 years ago

pseewald commented 3 years ago

Do you know how to make this compatible with Python 2.7? I get the error

  File "/home/travis/build/pseewald/fprettify/fprettify/__init__.py", line 241
    raise FprettifyParseException("non-standard expression involving + or -",'',0) from None
                                                                                      ^
SyntaxError: invalid syntax
e-kwsm commented 3 years ago

Well, python2 does not support the syntax..

nbehrnd commented 3 years ago

Maybe your system is set up to work in Python2 and neither a portable Python3 on a USB drive (e.g., WinPython (1)), nor a separate minimal installation of, say Miniconda (2) suits your needs. If the number of .f95 (or higher) files is manageable and their content is not confidential, you may consider to prettify them on repl.it as an installation free alternative. Then all you need is a web browser connected to them.

Once registered, e.g. via GitHub credentials

This is possible because one of the programming languages installed on this server is Python 3.8. (By an explicit call of python2, the bash session either starts Python 2.7.17, or 2.7.18.)

Side note: there is an elder gfortran-7 installed there, too. Thus, depending on the code's instructions it is possible to run gfortran test.f95 -o executable followed by ./executable on the spot, too.

Norwid

(1) https://winpython.github.io/ (2) https://docs.conda.io/projects/conda/en/latest/user-guide/install/download.html#anaconda-or-miniconda

On Wed, 11 Nov 2020 12:58:22 -0800 Eisuke Kawashima notifications@github.com wrote:

Well, python2 does not support the syntax..

pseewald commented 3 years ago

This is not the problem - I decided to make fprettify compatible with Python 2.7 as long as many systems come with Python 2.7 as the default Python version. This has probably changed in the mean time as Python 2 reaches end of life this year, and dropping Python 2 support is probably the way to go.