You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A DuplicateFlagError is thrown when:
1) Module A imports the gflags module and defines gflags.
2) Module A imports B
3) Module B imports A
Example:
File main.py:
---------------------------------
#!/usr/bin/python2.6
import sys
import gflags
import dep # error
FLAGS = gflags.FLAGS
gflags.DEFINE_boolean("example", True, "example_flag")
if __name__ == "__main__":
FLAGS(sys.argv)
print FLAGS.example
---------------------------------
File dep.py:
---------------------------------
#!/usr/bin/python2.6
import main
---------------------------------
Error output:
---------------------------------
Traceback (most recent call last):
File "example\main.py", line 10, in <module>
gflags.DEFINE_boolean("example", True, "example_flag")
File "C:\gflags\python\gflags.py", line 2378, in DEFINE_boolean
DEFINE_flag(BooleanFlag(name, default, help, **args), flag_values)
File "C:\gflags\python\gflags.py", line 2190, in DEFINE_flag
fv[flag.name] = flag
File "C:\gflags\python\gflags.py", line 1040, in __setitem__
raise DuplicateFlagError(name, self)
gflags.DuplicateFlagError: The flag 'example' is defined twice. First from
main, Second from example\main.py
Original issue reported on code.google.com by linshu...@google.com on 26 Mar 2012 at 7:11
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
linshu...@google.com
on 26 Mar 2012 at 7:11The text was updated successfully, but these errors were encountered: