Title: DuplicateFlagError when module with gflags definition is reimported · Issue #9 · gflags/python-gflags · GitHub
Open Graph Title: DuplicateFlagError when module with gflags definition is reimported · Issue #9 · gflags/python-gflags
X Title: DuplicateFlagError when module with gflags definition is reimported · Issue #9 · gflags/python-gflags
Description: 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 gf...
Open Graph Description: 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: --------------------------------- #...
X Description: 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: --------------------------------- #...
Opengraph URL: https://github.com/gflags/python-gflags/issues/9
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"DuplicateFlagError when module with gflags definition is reimported","articleBody":"```\nA DuplicateFlagError is thrown when:\n1) Module A imports the gflags module and defines gflags.\n2) Module A imports B\n3) Module B imports A\n\nExample:\n\nFile main.py:\n---------------------------------\n#!/usr/bin/python2.6\n\nimport sys\nimport gflags\nimport dep # error\n\nFLAGS = gflags.FLAGS\ngflags.DEFINE_boolean(\"example\", True, \"example_flag\")\n\nif __name__ == \"__main__\":\n FLAGS(sys.argv)\n print FLAGS.example\n\n---------------------------------\n\n\nFile dep.py:\n---------------------------------\n#!/usr/bin/python2.6\n\nimport main\n---------------------------------\n\n\nError output:\n---------------------------------\nTraceback (most recent call last):\n File \"example\\main.py\", line 10, in \u003cmodule\u003e\n gflags.DEFINE_boolean(\"example\", True, \"example_flag\")\n File \"C:\\gflags\\python\\gflags.py\", line 2378, in DEFINE_boolean\n DEFINE_flag(BooleanFlag(name, default, help, **args), flag_values)\n File \"C:\\gflags\\python\\gflags.py\", line 2190, in DEFINE_flag\n fv[flag.name] = flag\n File \"C:\\gflags\\python\\gflags.py\", line 1040, in __setitem__\n raise DuplicateFlagError(name, self)\ngflags.DuplicateFlagError: The flag 'example' is defined twice. First from \nmain, Second from example\\main.py\n\n```\n\nOriginal issue reported on code.google.com by `linshu...@google.com` on 26 Mar 2012 at 7:11\n","author":{"url":"https://github.com/GoogleCodeExporter","@type":"Person","name":"GoogleCodeExporter"},"datePublished":"2015-07-20T02:23:56.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/9/python-gflags/issues/9"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6e8a328b-a8ba-09a2-c4e3-1e1f1f8f001e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8016:3F9A9A:A7CF9C:ED60DD:6978C687 |
| html-safe-nonce | b1f6aff27607824647b24a2c6154aa9356bc56909d2be0e42b9246aaaac4eaf0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MDE2OjNGOUE5QTpBN0NGOUM6RUQ2MEREOjY5NzhDNjg3IiwidmlzaXRvcl9pZCI6IjEyOTMzODA4MjI1ODQ4Mzc3NjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 58d99fc1af638e58db0d57323c78b1af1a9a62c49640b50abb7665f127247283 |
| hovercard-subject-tag | issue:95970235 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/gflags/python-gflags/9/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c350b6fd1401ed70e2c7b182723a2e89de87614827cc3b7d90ccf7df4135d34c/gflags/python-gflags/issues/9 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c350b6fd1401ed70e2c7b182723a2e89de87614827cc3b7d90ccf7df4135d34c/gflags/python-gflags/issues/9 |
| og:image:alt | 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: --------------------------------- #... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | GoogleCodeExporter |
| hostname | github.com |
| expected-hostname | github.com |
| None | 8a71ca1f7ab5436216e1df86f398ef7a51ed3152c90e3f7332fc70cf97fcb9d6 |
| turbo-cache-control | no-preview |
| go-import | github.com/gflags/python-gflags git https://github.com/gflags/python-gflags.git |
| octolytics-dimension-user_id | 11634238 |
| octolytics-dimension-user_login | gflags |
| octolytics-dimension-repository_id | 39358388 |
| octolytics-dimension-repository_nwo | gflags/python-gflags |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 39358388 |
| octolytics-dimension-repository_network_root_nwo | gflags/python-gflags |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | eaed570eead52a9920afef75dc3eb6d826fdc5ef |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width