Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Syntax error: "except gflags_validators.Error, e:" line 1091 of gflags.py #20

Closed
benoitpointet opened this issue Jul 31, 2015 · 10 comments

Comments

@benoitpointet
Copy link

File "/Users/benoitpointet/anaconda3/lib/python3.4/site-packages/python_gflags-2.0-py3.4.egg/gflags.py", line 1091
    except gflags_validators.Error, e:

shouldn't it be the following?

except gflags_validators.Error as e:
@jaradc
Copy link

jaradc commented Oct 13, 2015

Yep! Same error. Is there anyone paying attention to this? You posted the issue on July 31 and today it's October 12, 2015 so my guess is no. I think python-gflags is only for Python 2.7. I wonder if 2to3 would fix this?

@vrusinov
Copy link
Contributor

I am currently working on pushing a very new version of gflags here (at my free time, so don't expect it to happen very soon) which may or may not fix this problem (and I'm sure will introduce more problems).

So yes - we are paying attention, but it does not make much sense to push a fix to version which is currently here. Please stay tuned.

@jaradc
Copy link

jaradc commented Oct 14, 2015

No worries. I did get it fixed on my end with a few simple changes between Python 2 and 3. Those changes can be found here if interested but nothing really interesting - changing print statements and error handling syntax.

vrusinov added a commit that referenced this issue Jul 17, 2016
It is declares python2-only at the momens since there are still issues with
python3 support.

Related:
 - github pull request #22
 - github pull request #26
 - github pull request #29
 - github issue #28
 - github issue #20

	Change on 2016/06/20 by vrusinov <[email protected]>

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=125322335
@Kurt-von-Laven
Copy link

@vrusinov, I recently noticed that python-gflags is the only Python package my team uses that doesn't support Python 3, so I am planning to migrate to argparse. I say this in the interest of transparency/providing anecdotal data as opposed to telling Google how it should prioritize support for its generous open-source contributions. (We do, all things being equal, prefer the distributed nature of gflags to the monolithic nature of argparse.) I am curious, given my plan, if there is an approximate ETA for Python 3 support in python-gflags available. I also noticed that Ubuntu maintains a Python 3 version of gflags in case that is of any help.

@gpshead
Copy link
Contributor

gpshead commented Aug 1, 2016

Using argparse is what I would recommend for now. We can't commit to a timeline of adding official Python 3 support to python-gflags as it isn't the module we want people to continue using for open source code.

There are some other existing Python 3 ports of gflags out there as you have noticed.

My vision is for an gflags-like API, supporting Python 2.7 and 3.4+, that also synchronizes flags with C++ gflags when any extension modules are linked against C++ code using that. This might even be based on argparse internally if it makes sense to do so.

@Kurt-von-Laven
Copy link

Thank you, @gpshead. Will switch over to argparse then. Out of curiosity, what is the module you want people to continue using for open source code?

@gpshead
Copy link
Contributor

gpshead commented Aug 1, 2016

We recommend argparse as it is what most people using Python in the world expect.

@Kurt-von-Laven
Copy link

Oh, gotcha. Thanks again.

@gpshead
Copy link
Contributor

gpshead commented Sep 28, 2017

python-gflags users should migrate to absl-py:
https://github.com/abseil/abseil-py
https://pypi.python.org/pypi/absl-py/

It is the modern version of this library.

@gpshead gpshead closed this as completed Sep 28, 2017
@kingjr
Copy link

kingjr commented Jan 23, 2019

pip install python-gflags --upgrade fixed the problem for me

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

6 participants